This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes Original Servlet Name after a Forward to a jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Servlets
Bookmark "Original Servlet Name after a Forward to a jsp" Watch "Original Servlet Name after a Forward to a jsp" New topic

Original Servlet Name after a Forward to a jsp

sandy gupta
Ranch Hand

Joined: Jan 30, 2001
Posts: 228
I am sure there is an answer to this one but i have not been able to find out.
I have a servlet registered as xxx from which i forward to some jsp page /yyy/zzz.jsp
How can i get the original xxx Servlet name in the zzz.jsp
I have tried the Referer in the header, the request URI, the Servlet name in the request and the Path Info. None of these have worked as all return /yyy/zzz.jsp
Any Help will be greatly appreciated

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13001
Maybe you should attach the servlet name to the request with setAttribute before forwarding so the JSP can get it later.
Garrett Smith
Ranch Hand

Joined: Jun 27, 2002
Posts: 401
it shouldn't matter which servlet they came from the jsps point of view. Jsp shouldn't handle conditional logic, or if it does, it should be limited to just presentation as much as possible.
Having said that, you could use request.getRequestURL() (see the javadoc for HttpServletRequest).

comp.lang.javascript FAQ:
Have you checked out Aspose?
subject: Original Servlet Name after a Forward to a jsp
It's not a secret anymore!