My domtree program:
package project1;
import javax.servlet.;
import javax.servlet.http.;
import java.io.;
import java.util.;
import javax.xml.parsers.;
import org.w3c.dom.;
import toolbox.*;
public class Servlet1 extends HttpServlet {
//Initialize global variables
public static String bianhao,xingming,fenfabumen,danrengongzuo,Year1,Month1,benxin,jishujintie;
public static Document doc;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType(“text/html;charset=GB2312”);
request.setCharacterEncoding(“GB2312”);
bianhao=request.getParameter(“bianhao”);
xingming=request.getParameter(“xingming”);
fenfabumen=request.getParameter(“fenfabumen”);
danrengongzuo=request.getParameter(“danrengongzuo”);
Year1=request.getParameter(“Year1”);
Month1=request.getParameter(“Month1”);
benxin=request.getParameter(“benxin”);
jishujintie=request.getParameter(“jishujintie”);
System.out.println(“iuaysdhflkjsahdflkjhsdaflksda”);
// ???group tree in ram
try{
javax.xml.parsers.DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
javax.xml.parsers.DocumentBuilder builder=factory.newDocumentBuilder();
doc=builder.newDocument();
Element root=doc.createElement(“???”);
Element table=doc.createElement(“??”);
Element bianhao1=doc.createElement(“??”);
bianhao1.appendChild(doc.createTextNode(bianhao));
table.appendChild(bianhao1);
Element xingming1=doc.createElement(“??”);
xingming1.appendChild(doc.createTextNode(xingming));
table.appendChild(xingming1);
Element fenfabumen1=doc.createElement(“???”);
fenfabumen1.appendChild(doc.createTextNode(fenfabumen));
table.appendChild(fenfabumen1);
Element danrengongzuo1=doc.createElement(“???”);
xingming1.appendChild(doc.createTextNode(danrengongzuo));
table.appendChild(danrengongzuo1);
Element daochangriqi=doc.createElement(“???”);
Element Year11=doc.createElement(“?”);
Year11.appendChild(doc.createTextNode(Year1));
daochangriqi.appendChild(Year11);
Element Month11=doc.createElement(“?”);
Month11.appendChild(doc.createTextNode(Month1));
daochangriqi.appendChild(Month11);
table.appendChild(daochangriqi);
Element benxin1=doc.createElement(“??”);
benxin1.appendChild(doc.createTextNode(benxin));
table.appendChild(benxin1);
Element jishujintie1=doc.createElement(“??”);
jishujintie1.appendChild(doc.createTextNode(jishujintie));
table.appendChild(jishujintie1);
root.appendChild(table);
doc.appendChild(root);
//TaminoWrapper.Process(“http://localhost/tamino/sinocomm”,doc);
//DOMWrapper.writeToXML(doc);
}
catch(Exception ex)
{
System.out.println(“Error”);
}
/*PrintWriter out = response.getWriter();
out.println(“”);
out.println(“gettree”);
out.println(“”);
out.println(“
The servlet has received a post.This is the reply.
”);out.println(bianhao+“
”+xingming+“
”+fenfabumen
+“
”+danrengongzuo+“
”+Year1+“
”+Month1);
out.println(“”); */
}
public void destroy() {
}
}
Error:
type Exception reportmessage Internal Server Errordescription The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.exception javax.servlet.ServletException: Servlet execution threw an exception
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
…
root cause java.lang.NoSuchMethodError
at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(DocumentBuilderFactoryImpl.java:82)
at project1.Servlet1.doGet(Servlet1.java:34)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
…
Why?If two packages have the same class,how can I choose it?
I am a Java NewComer.