This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

slash "/"

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why is that atrributes
location and url-Pattern should always start with "/"
is this relative to servletcontext or anything else???
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats because the DTD says so. For the url-pattern, however, you have the option of starting it with a "/" or otherwise. If it starts with a "/", it must be relatiove to the servlet-context.
regds.
- madhav

<!--
The location element contains the location of the resource in the web application relative to the root of the web application. The value of the location must have a leading ‘/’.
Used in: error-page
-->
<!ELEMENT location (#PCDATA)>

<!--
The url-pattern element contains the url pattern of the mapping. Must follow the rules specified in Section 11.2 of the Servlet API Specification.
Used in: filter-mapping, servlet-mapping, web-resource-collection
-->
<!ELEMENT url-pattern (#PCDATA)>
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
well what madhav said is right. this is just my 2 cents.
i guess the original idea of using "/" to represent the servlet context came from unix root directory concept. and as the servlet context is the root for all the web documents (regarding servlets/jsp etc) on the server it uses "/".
btw, madhav i am back on javaranch after 2 months i guess but i remember u used to write ur name "satya" if i am not forgetting u y such a change in ur policy?
regards
maulin.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic