Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Get the JSP name in a servlet  RSS feed

 
Ghazala Islam
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any method that i can check in a servlet that request is coming from "which JSP" ?if yes,

- how can i set the value in JSP to be read in a servlet.
- how can i read the value(name of jsp) in the servlet.


Thanks.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Requests don't come from JSPs.
They come from client apps (usually browsers).
The page from where the request was initiated may have been generated with a JSP but there is nothing in any part of the HTTP post that will indicate this.

You could add your own information in the form of querystring variables or hidden form fields.

The HTTP "Referer" variable will sometimes let you know the URI of the page that contained the link to the current request.
 
Scott Selikoff
author
Bartender
Posts: 4093
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, which JSPs are they allowed to come from? For example, would JSPs on another site be valid? If you're trying to guarentee users only execute JSP pages in a particular order (not user friendly) you might consider adding a session variable that monitors the last page the user visited.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!