java - Help creating servlet in existing jsf project -
i'm trying create servlet inside jsf project. first servlet i've created , i'm using http://www.servletworld.com/servlet-tutorials/simple-servlet-example.html example me started.
the thing folder structure little different because of existing jsf.
i can form.html page display, when type name in , click submit, 404.
my folder structure follows (only relevant files shown)
catalog (my project in eclipse) - src - - b - c - catalog - backing - welcomeservlet.java - webcontent - catalog - form.html - web-inf - web.xml - classes - - b - c - catalog - backing - welcomeservlet.class
here servlet mappings in web.xml
<servlet> <servlet-name>welcomeservlet</servlet-name> <servlet-class>a.b.c.catalog.backing.welcomeservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>welcomeservlet</servlet-name> <url-pattern>/welcomeservlet</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>/form.html </welcome-file> </welcome-file-list> <servlet> <servlet-name>faces servlet</servlet-name> <servlet-class>javax.faces.webapp.facesservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>faces servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>/index.jsp</welcome-file> <welcome-file>/index.html</welcome-file> </welcome-file-list>
this url brings form.html page fine http://localhost:8080/catalog/catalog/form.html
when click submit button, brings url http://localhost:8080/catalog/catalog/welcomeservlet , gives 404 error. i'm thinking there issue in web.xml file, i'm not , can't figure out.
thanks
try adding after first servlet mapping:
<servlet-mapping> <servlet-name>welcomeservlet</servlet-name> <url-pattern>/catalog/welcomeservlet</url-pattern> </servlet-mapping>
Comments
Post a Comment