This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JSP and the fly likes Printing path to JSP from tag file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Printing path to JSP from tag file" Watch "Printing path to JSP from tag file" New topic
Author

Printing path to JSP from tag file

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
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

Joined: Jan 11, 2006
Posts: 160
Are you really looking for getRequestURI() or getRequestURL()? getPathTranslated() looks at extra information contained in the url


Rashid Mayes
http://www.hostj2me.com/ - http://www.worlddeveloper.org/
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

Inspect these two lines carefully:

pageContext.setAttribute("pathinfo",getpath);

${getpath}


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printing path to JSP from tag file
 
Similar Threads
controlling printing in generated HTML page
Path of jsp files.
jsp can't find file
Reading and writing to a JSP file using I/O
File path issues while reading an xsl file in java