Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

web.xml & JSP

 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to hide the implementation of my jsp pages?
What I mean is I dont want my urls to all be
http://127.0.0.1/webapp/jsp/test.jsp
Maybe have my URL say anything else but that...
All my jsps will be in a folder called jsp under the webapp dir.
 
John Smith
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stick this in your web.xml file
for each jsp
<servlet-name>test</servlet-name>
<display-name>test</display-name>
<jsp-file>/test.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/qwerty</url-pattern>
</servlet-mapping>
now instead of: localhost:8080/name/jsp/test.jsp
used localhost:8080/name/qwerty
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic