• Post Reply Bookmark Topic Watch Topic
  • New Topic

Forward slash query  RSS feed

 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have many web.xml elements
a. which can take value starting with forward slash
b. which can NOT take value starting with forward slash.
c. which can take value starting with or without forward slash
Do we have any key rules/guidelines/tricks that can help me remember which elements take values with forward slash and which take values without forward slash?

~ Abhay
 
Ankit Garg
Sheriff
Posts: 9610
37
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lets make a list of tags which actually take path to files or URL patters in web.xml (and which are covered in the exam, if I missed any you can add them)

url-pattern (inside servlet-mapping, filter-mapping and web-resource-collection tags)
jsp-file (inside servlet tag)
welcome-file (inside welcome-file-list tag)
location (inside error-page tag)
tag-lib-location (inside taglib which is itself inside jsp-config tag)
form-login-page and form-error-page (inside form-login-config tag)

Now see which tags can accept paths starting from / or without / or both and see if you can find any fix pattern. Some of the information on the pages that I linked might be wrong, for example the value of jsp-file tag must start with / as the spec says
Servlet 2.4 spec wrote:The jsp-file element contains the full path to a JSP file within the web application beginning with a “/”.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!