Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Berkely DB > how can the BDB...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1712 of 1804
Post > Topic >>

how can the BDB XML work with jsp and english and display the code in big5?

by "Edith" <siu_bang@[EMAIL PROTECTED] > Feb 8, 2007 at 10:00 AM

Hi all,

i think i do the config for the tomcat server correctly.
JAVA API.
but i don't know how to put the target word in big5 code,
and then search in the .dbxml files with utf-8,
finally display the result in big5?

also, i can do the print in java program,
but after i implement it into jsp, the result didn't appear~~~

can the expert here teach me how?
because i'm doing the honor project and it is running out of time.

THXTHXTHXTHX~

Edith


P.S. here is the code segment of the jsp
--------------------------
<html>
<head><title>Query Result</title></head>
<%@[EMAIL PROTECTED]
 page contentType="text/html; charset=utf-8" language="java"
im****t="java.util.*" %>
<%@[EMAIL PROTECTED]
 page im****t="java.io.*"%>
<%@[EMAIL PROTECTED]
 page im****t="javax.swing.*"%>
<%@[EMAIL PROTECTED]
 page im****t="com.sleepycat.dbxml.*"%>
<%@[EMAIL PROTECTED]
 page im****t="com.sleepycat.db.*"%>
<%@[EMAIL PROTECTED]
 page im****t="dbxml.fyp.*"%>
<body>
<%
 String theContainer=null, collection=null, target=null;
	theContainer = "glossary.dbxml";
    collection = "collection('glossary.dbxml')";
    target=request.getParameter("target");
    String[] display=null;

	XmlTransaction txn = null;
	File file = new File("e:/dbEnv");
	myDbEnv env = new myDbEnv(file);

	XmlManager theMgr = env.getManager();
	XmlContainer myContainer = theMgr.openContainer(theContainer);

    //Find all the glossary do***ents in the database
	String query="/ * /*[@[EMAIL PROTECTED]
";

	//Perform a single query against the referenced container.
	// No context is used for this query.
	String fullQuery = collection + query;
	XmlQueryContext qc = theMgr.createQueryContext();

	// Add a variable to the query context, used by the query
	qc.setVariableValue("expression", new XmlValue(target));
	XmlQueryExpression expr = theMgr.prepare(fullQuery, qc);

	    XmlResults res = expr.execute(qc);
	    out.println("The query, '" + expr.getQuery() + "'<br> returned "
+ res.size() + " result(s)<br>");

		XmlValue value = new XmlValue();
	    out.println("Result: "+"<br>");
            int count=0;
	    while ((value = res.next()) != null) {
		out.println("<br>" + value.asString());
                display[count++]= value.asString();
		value.delete();
	    }
myContainer.close();
theMgr.delete();
%>
<br>
<%=request.getParameter("target")%><br>
<%=display%><br>
<%=count()%>
</body>
</html>
 




 1 Posts in Topic:
how can the BDB XML work with jsp and english and display the co
"Edith" <siu  2007-02-08 10:00:02 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Thu Jul 24 6:21:24 CDT 2008.