aspose file tools*
The moose likes Servlets and the fly likes Servlet Mapping doesn't work in Tomcat 5.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Mapping doesn Watch "Servlet Mapping doesn New topic
Author

Servlet Mapping doesn't work in Tomcat 5.5

Sarath Mohan
Ranch Hand

Joined: Mar 17, 2001
Posts: 213
I have the following servelet decleration in my web.xml


http://localhost:8080/myapp/anyjsp.jsp --- > Works fine
http://localhost:8080/myapp/simple-man --- > gives resouce not found exception.

I haven't modified any thing in other config files.

Any quick help?

Regards


Sarath Mohan
Avisesh Jain
Greenhorn

Joined: Mar 16, 2005
Posts: 12
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/simple-man</url-pattern>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>

Remove the fourth line in the above code it should work fine
Sarath Mohan
Ranch Hand

Joined: Mar 17, 2001
Posts: 213
Thanks Avisesh. Its working. But when I add *.jsp entry, the /simple-man is not working and vice versa. Could any body tell me a way where I need to map all jsps to a servlet and all request to a directory.

Thanks
Avisesh Jain
Greenhorn

Joined: Mar 16, 2005
Posts: 12
Why do you need to map all JSPs to a single servlet? I think your requirement is to pass the request to the same servlet from all JSPs, if that is the case then use the action parameter of the form in JSP to redirect to your servlet. See the URL mapping has to be unique u cannot map all JSPs to a single URL.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

As far as I know, you can only have one url-pattern per mapping.
Try creating a separate mapping for each url-pattern.



Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Sarath Mohan
Ranch Hand

Joined: Mar 17, 2001
Posts: 213
Hi ben,

It worked perfectly

Thanks your valuable suggestion

Cheers
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Mapping doesn't work in Tomcat 5.5