Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Simple Web App, Referring URL  RSS feed

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating a super simple Web App. I am not using anything fancy. Probably won't even use TagLibs. Basically, I have a login.jsp, AddReference.jsp, and ViewReference.jsp.
Everything is working pretty well. What I am trying to do now is if the user goes to AddReference or ViewReference, and he/she has not logged in, I need to redirect them to the login.jsp page. No problem there. But after they log in, they need to be redirected back to the page in which they were referred to the login.jsp page.
My first thought was to add a hidden field to each restricted page and set it's value to that that page. Then, when redirected to login, just look at that hidden field for the value of where to redirect back to.
Is this a good idea, bad idea? Is there another more J2EE way of handling this.
Keep in mind I am keeping this really simple. So I am not going to use Forms Authentication or anything like that within Tomcat. Everything will be handled from the jsp/servlet pages.
Thanks.
[ September 18, 2003: Message edited by: Gregg Bolinger ]
 
Scott Duncan
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could put it in the session of course. Nothing wrong with doing it your way though in my opinion.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks William. I thought about putting it in the session. I don't think it would matter much either way.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about using StringBuffer url = request.getRequestURL();
Is that the prefered method?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!