• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Printing path to JSP from tag file

 
Ranadhir Nag
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do we print out the path to a JSP from within a tag file hosted on the jSP.
In the tag file ,we do the following:
<%
String getpath=pageContext.getRequest().getPathTrnaslated();
pageContext.setAttribute("pathinfo",getpath);
%>
${getpath}


But this is printing out null.
How do we print out the Url of the including JSP?
 
Rashid Mayes
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you really looking for getRequestURI() or getRequestURL()? getPathTranslated() looks at extra information contained in the url
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64618
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inspect these two lines carefully:

pageContext.setAttribute("pathinfo",getpath);

${getpath}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic