Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Mapping doesn't work in Tomcat 5.5

 
Sarath Mohan
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Avisesh Jain
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know, you can only have one url-pattern per mapping.
Try creating a separate mapping for each url-pattern.

 
Sarath Mohan
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ben,

It worked perfectly

Thanks your valuable suggestion

Cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic