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

Need to stay on the same page  RSS feed

 
Taras Riznyk
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys.

Please advice. Have next problem.
I use login form in Header.jsp file that will be included in all JSPs in my project. After user inputs login credentials, need to redirect him to the page submit was made from, without knowing the page before runtime.
Using, for example, (where MAIN_PAGE="/WEB-INF/jsp/Main.jspx"), I navigate to predefined pages, but don't know how to navigate the previous page in runtime.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66188
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked on the request for a method that might give you information on what the URL of the current page is?

If you have that info, you could submit it along with the credentials and redirect to that URL after authentication.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66188
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another approach: how much does the current page change after authentication? If not much, you could consider using Ajax and never leaving the page in the first place.
 
Taras Riznyk
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, I have tried to use the request methods, but the best result I got is the request URL and it contains the name of servlet not JSPs. I need somehow to obtain or previous RequestDispatcher or string path to jsp in WEB-INF directory in which the header is included.
Maybe I will consider using AJAX, but anyway it is good to know how to resolve this using servlet
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66188
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do not want to go back to the page directly. You always want to go back to the same page through the servlet controller. Otherwise, the controller prep for the page is omitted.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!