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>


|