Manoj Kithany wrote: > Hi Mr. Hans, > > THANKS for your reply. > > I made changes to what you said and when I put my WAR file to dpeloy folder > get following error at consoel: > ---------------------------------------------- > 13:47:48,746 INFO [STDOUT] org.xml.sax.SAXParseException: Element > "servlet-mapping" does not allow "url-pattern" here. > 13:47:48,746 ERROR [Engine] ContextConfig[/kithany] Parse error in > application web.xml > org.xml.sax.SAXParseException: Element "servlet-mapping" does not allow > "url-pattern" here. > at org.apache.crimson.parser.Parser2.error(Parser2.java:3086) > ---------------------------------------------- > > THANKS again!
Are you sure you put the elements in the order I showed in my reply (I believe the other person that replied had them in the wrong order). The <servlet-mapping> element is defined like this in the web.xml DTD: <!ELEMENT servlet-mapping (servlet-name, url-pattern)> I.e., they must be entered in the order I showed. Hans >> From: Hans Bergsten <[EMAIL PROTECTED]> >> Reply-To: A mailing list about Java Server Pages specification and >> reference <[EMAIL PROTECTED]> >> To: [EMAIL PROTECTED] >> Subject: Re: JSP working but Servlets not working >> Date: Sun, 22 Sep 2002 12:26:52 -0700 >> >> Manoj Kithany wrote: >> >>> Hi Experts, >>> >>> Greetings! >>> >>> I am using Apache 1.3.26 + (Jboss 3.0.3, Tomcat 4.0.4 bundle) >>> I treid to creat a small Web Application. My JSP files are WORKING >>> properly >>> BUT when Servlet is called (from JSP Page), >>> I get "No Context COnfigured Error" >>> >>> My Directory structure is as follows: >>> /kithany (root) >>> /kithany/register.htm >>> /kithany/WEB-INF/web.xml >>> /kithany/WEB-INF/classes/HelloWorldExample.java >>> /kithany/WEB-INF/classes/HelloWorldExample.class >>> /kithany/META-INF/application.xml >>> >>> >>> I have my APPLICATION.XML file as follows: >>> ------------------------------------------------------------------------- >>> >>> <?xml version="1.0" encoding="ISO-8859-1"?> >>> <application> >>> <display-name>KITHANY</display-name> >>> <module> >>> <web> >>> <web-uri>kithany.war</web-uri> >>> <context-root>/kithany</context-root> >>> </web> >>> </module> >>> </application> >>> ------------------------------------------------------------------------- >>> >>> >>> And, my WEB.XML file is as: >>> ------------------------------------------------------------------------- >>> >>> <?xml version="1.0" encoding="UTF-8"?> >>> <!DOCTYPE web-app >>> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" >>> "http://java.sun.com/dtd/web-app_2_3.dtd"> >>> <web-app> >>> <servlet> >>> <servlet-name>HelloWorldExample</servlet-name> >>> <servlet-class>HelloWorldExample</servlet-class> >>> </servlet> >> >> >> You need to add a mapping to the servlet as well: >> >> <servlet-mapping> >> <servlet-name>HelloWorldExample</servlet-name> >> <url-pattern>/HelloWorldExample/*</url-pattern> >> </servlet-mapping> >> >>> <welcome-file-list> >>> <welcome-file> >>> index.jsp >>> </welcome-file> >>> </welcome-file-list> >>> </web-app> >>> ------------------------------------------------------------------------- >>> >>> >>> My JSP file "register.jsp" is shown below. This file calls a SERVLET >>> HelloWorldExample.class when user clicks. >>> ------------------------------------------------------------------------- >>> >>> >>> <html> >>> <body> >>> <form action="/HelloWorldExample" method=post> >> >> >> Here's the main problem: you're using an absolute path (starting with a >> slash) for the servlet, so when you submit the form, it's submitted >> to "/HelloWorldExample" but it should be "/kithany/HelloWorldExample". >> >> Change to a relative path instead (i.e., remove the leading slash): >> >> <form action="HelloWorldExample" method=post> >> >>> [...] >>> Which I then, put it into /jboss/server/default/deploy and then start my >>> JBOSS(Tomcat/Catalina) Server and then on browser, I type following: >>> http://MY_IP_ADDR_ESS:8080/kithany/register.html which displays the file >>> correctly. When the user clicks SUBMIT, the file should call >>> HelloWorldExample.class file BUT it displays Error like: >>> >>> "Apache Tomcat/4.0.3 - HTTP Status 500 - No Context configured to >>> process >>> this request" >> >> >> Yes, because the path you use points to the root context, not your >> context (see above). > > > > > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > =========================================================================== > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff > JSP-INTEREST". > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST > DIGEST". > Some relevant FAQs on JSP/Servlets can be found at: > > http://archives.java.sun.com/jsp-interest.html > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.jsp > http://www.jguru.com/faq/index.jsp > http://www.jspinsider.com > -- Hans Bergsten [EMAIL PROTECTED] Gefion Software http://www.gefionsoftware.com JavaServer Pages http://TheJSPBook.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com