Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help!

 
MInu
Ranch Hand
Posts: 517
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...

what is the meaning of this type of url definition.

<url-pattern>/name/*</url-pattern>

Thanks
 
MInu
Ranch Hand
Posts: 517
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got answer....


If we want to use path prefix mapping, we
have to do like this:


code:
________________________________________________________________
<servlet-mapping>
<servlet-name>myServlet</servlet-name>
<url-pattern>/sth/*</url-pattern>
</servlet-mapping>


________________________________________________________________
Does that mean we can map to myServlet like this now?

http://localhost/sth/whatever
 
Anand Wadhwani
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very well yes!

The url-pattern defines the virtual name for your servlet class. This name would appear in the URL which in turn appears to client of your website. So this is a good way of hiding your actual servlet class name from client. At the same time it gives to ability to define virtual (logical) directories appearing in URL which are not actual directories on your server!

Also please note that you cannot invoke your servlet without mapping to a url-pattern. It's mandated by container!

Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic