The original question does not mention that they are trying to map the root servlet in App Engine - this is easy on Tomcat (and other servlet containers, as far as I know), but App Engine is not a regular servlet container.
My usual way to create a web application with servlets is to extend the HttpServlet, add a “page” object with a title, content, errors, messages, etc. and for output forward to the JSP template. It was an absolute nightmare running in App Engine.
- JSP files cannot be "named" without a "/" at the beginning.
- JSP files cannot be in a subdirectory
- Servlets cannot be mapped to the root of your application using the url template //
Here is my web.xml (edited for brevity) that finally worked.
<web-app> <servlet> <servlet-name>Home</servlet-name> <servlet-class>my.domain.HomeSv</servlet-class> </servlet> <servlet> <servlet-name>template</servlet-name> <jsp-file>/template.jsp</jsp-file> </servlet> <servlet-mapping> <servlet-name>Home</servlet-name> <url-pattern>/home</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>home</welcome-file> </welcome-file-list> </web-app>
I was not particularly trained in testing all of this, but it seems to work for me now, and I am very pleased with it.
Sam Lowry Sep 10 '09 at 6:25 2009-09-10 06:25
source share