Seriously, David's recommendation is the way forwards.When he said, 'read the spec', he was indicating that you should at least have a basic familiarity with what a Servlet is.
There are *extensive* and complete tutorials from basic to advanced to found for free online. Search Google (other search engines are available).
Clue: Servlets are not written like a bean Class, you do not use the main(...) method.
rgds Pid Luca Sabbio wrote:
Thank you very much for the two answers. I don't know Java servlet enough to make PartsXupdate work but now I have a way to follow.I highly recommend reading the servlet spec. There you will see a servlet extends HttpServlet and overrides one or more of it's methods. http://jcp.org/en/jsr/detail?id=154 --DavidNow that I've changed the class file, and re-do the deployment, Tomcat first show me HTTP Status 405 - HTTP method POST is not supported by this URL than I modify PartsXupdate.java as below and only work the out.println import org.xmldb.api.base.*; import org.xmldb.api.modules.*; import org.xmldb.api.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class PartsXupdate extends HttpServlet {public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { PrintWriter out = response.getWriter(); out.println("Commento Inserito"); } public static void main(String[] args) throws Exception { Collection col = null; try { String driver = "org.apache.xindice.client.xmldb.DatabaseImpl"; Class c = Class.forName(driver); Database database = (Database) c.newInstance(); DatabaseManager.registerDatabase(database);col = DatabaseManager.getCollection("xmldb:xindice://localhost:8080/db/test");String xupd = "<xupdate:modifications version=\"1.0\" xmlns:xupdate=\"http://www.xmldb.org/xupdate\">" +"<xupdate:insert-after select=\"/scheda/info\">" + "<xupdate:element name=\"commento\">Bel libro!</xupdate:element>" + "</xupdate:insert-after>" + "</xupdate:modifications>"; String nome = "4.xml"; /* We are using XUpdateQueryService */ XUpdateQueryService service =(XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");service.updateResource(nome, xupd); } catch (XMLDBException e) { System.err.println("XML:DB Exception occurred " + e.errorCode); } finally { if (col != null) { col.close();} } } }From: Luca Sabbio [mailto:[EMAIL PROTECTED] public class PartsXupdateextends HttpServlet{... - Peter --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
smime.p7s
Description: S/MIME Cryptographic Signature