I have a ActionServlet class. I want this index page be handled by this ActionServlet.
My web.xml has the following code: <servlet> <servlet-name>action</servlet-name> <servlet-class>logic.ActionServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> But when I press submit button in index page, I am getting /valid.do is not availabel. How to get rid of this problem? Please help me.
Hi, If use struts framework check the strust-config.xml for correct mapping of your servlet.
Raghu J<br />SCJP 1.4<br /> <br />The Wind and waters are always<br />on the side of the ablest navigators.<br /><a href="http://groups.yahoo.com/group/scjp_share" target="_blank" rel="nofollow">SCJP Group</a><br /><a href="http://groups.yahoo.com/group/JavaBeat_SCWCD" target="_blank" rel="nofollow">SCWCD Group</a>
Yup, you cannot have a leading '/' when using file extension mapping for url-pattern. Refer to Servlet specification 2.4, SRV.11.2.
You might want to try to include the context path into your html form action attribute, because the client browser interpret '/valid.do' as relative to the server root, instead of relative to application.
SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="http://eddyleesinti.blogspot.com" target="_blank" rel="nofollow">http://eddyleesinti.blogspot.com</a>
Joined: Nov 06, 2000
Thanks for pointing that out guys. I never really tried it, so I was not aware. Also, the Book I am using "More servlets and JSP" By Marty Hall on page 285 has servlet mapping that refers to a file extension, and there was a '/' in front of it.
Here is an excerpt from the book. <servlet-mapping> <servlet-name>BashMS</servlet-name> <url-pattern>/*.asp</url-pattern> </servlet-mapping>