• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

how to get previous page's url in jsp

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
let say i have login.jsp and home.jsp, when user input id and password and then click the normal button in logon.jsp, it will redirect to home.jsp page.
in home.jsp page, how can i get the url of the previous page (login.jsp) in home.jsp
and i need to check if the url=login.jsp, then i want to popup window, otherwise, it will hide the popup window.
any example coding for me for reference, i am beginner seeking for help. thanks.
 
Sheriff
Posts: 67399
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Checking for the URL is not the right way to go about this.

Rather, you can send data from the controller to the JSP that can tell the JSP that it needs to do whatever it is you want it to do.

Concept: your form submits to a servlet, the servlet determines what to do with the form data and processes it. Somewhere along the way, it determines that a popup should appear when the view is displayed (but really, a popup? what is the purpose? it's not an idea that is used much in modern design). It places a scoped variable in the session to indicate this, then redirects to the page controller for the next view. Either the page controller, or the page view (the JSP), can look into the session to see if the scoped variable indicates that the popup should be shown.

If any of the concepts are unfamiliar, please see this article for information on structuring Java web applications.
 
nonowhy hailey
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Checking for the URL is not the right way to go about this.

Rather, you can send data from the controller to the JSP that can tell the JSP that it needs to do whatever it is you want it to do.

Concept: your form submits to a servlet, the servlet determines what to do with the form data and processes it. Somewhere along the way, it determines that a popup should appear when the view is displayed (but really, a popup? what is the purpose? it's not an idea that is used much in modern design). It places a scoped variable in the session to indicate this, then redirects to the page controller for the next view. Either the page controller, or the page view (the JSP), can look into the session to see if the scoped variable indicates that the popup should be shown.

If any of the concepts are unfamiliar, please see this article for information on structuring Java web applications.



hi, thanks for your information. by the way, do you have the coding example that I can reference.
Thanks.
 
nonowhy hailey
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

nonowhy hailey wrote:

Bear Bibeault wrote:Checking for the URL is not the right way to go about this.

Rather, you can send data from the controller to the JSP that can tell the JSP that it needs to do whatever it is you want it to do.

Concept: your form submits to a servlet, the servlet determines what to do with the form data and processes it. Somewhere along the way, it determines that a popup should appear when the view is displayed (but really, a popup? what is the purpose? it's not an idea that is used much in modern design). It places a scoped variable in the session to indicate this, then redirects to the page controller for the next view. Either the page controller, or the page view (the JSP), can look into the session to see if the scoped variable indicates that the popup should be shown.

If any of the concepts are unfamiliar, please see this article for information on structuring Java web applications.



hi, thanks for your information. by the way, do you have the coding example that I can reference.
Thanks.



how to set the scoped variable to session in login.jsp (first page) controller before going to next view?
 
Saloon Keeper
Posts: 22112
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fix your display name and you'll get more answers.
 
You get good luck from rubbing the belly of a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic