Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet mapping

 
Anupam Sinha
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
Please explain as to what all servlets will map to the BlueServlet.
Assuming the web app is colorapp.

Should'nt /colorapp/hello/blue/ map to BlueServlet.
Please provide examples of what all servlets will match the mapping.
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good question Anupam. If anyone has extra resources (besides the SCWCD study kit) that explain this please provide. I'm having heaps of problems with this.
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying using
<servlet-mapping>
<servlet-name>BlueServlet</servlet-name>
<url-pattern>/blue</url-pattern>
<servlet-mapping
...
I think the trailing slash (/) after the word blue is causing a problem, and the tag name should be "url-pattern".
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
the following entry maps the BlueServlet to all request under the
path ..../blue/..
<servlet-mapping>
<servlet-name>BlueServlet</servlet-name>
<url-pattern>/blue/*</url-pattern>
<servlet-mapping>
Olli
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic