Avatar of dodowoman
dodowoman

asked on 

how to make navigation of pages easy without losing variable values in between?

dear experts,

my jsp application provides multiple "submit" functions in different pages which have to pass some values to the next pages or java classes to return the proper results. however, i don't want the users to receive error message when they just use "back button" on the browser to go back to some previous page and re-submit again since some values might not exist any more.

what should I do? what is the best way to handle case like this? should I just set all the variables to a session variables? i worry that might slow down the application and some side affect. thanks
JSP

Avatar of undefined
Last Comment
olgavillamizar
ASKER CERTIFIED SOLUTION
Avatar of WelkinMaze
WelkinMaze

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of dodowoman
dodowoman

ASKER

thanks, i agree that tere is some security concern. so, what would be the best solution for this? just let your see the error page? or tell them not to use return button, but have to re-login every time? what is your suggestion?
Avatar of WelkinMaze
WelkinMaze

It depends primarily on what you want to achieve. You can keep their session for some time, for example 15 minutes, and after 15 minutes without activity you can close it and display some message about session timeout.
Avatar of dodowoman
dodowoman

ASKER

thanks, but now do we set the session time?
Avatar of WelkinMaze
WelkinMaze

You manage the session time on the server side. Initialize a timer when the user logs in and restart it to zero everytime when he accesses the server. If the timer reach the desired time on the server you close the user session and the next time when the user request something from the server you display a "session timeout" message (with a login form if you want).
Avatar of dodowoman
dodowoman

ASKER

thanks, it does sound like a good thing to do. But, how to implement this "session management" on server side? Could you please provide some examples or info?
Avatar of WelkinMaze
WelkinMaze

This is a simple scheme to do it. You must already have some code that handles the login of the user. So in this code you may also initialize a counter (timer). And also you may put in your jsp pages some some code that resets this counter to zero when the page is accessed. And store this counter in the session.
Are you using just JSP or you are programming using Struts??
Avatar of dodowoman
dodowoman

ASKER

Yes, I am tring to use Struts as my framework. Any advice? thanks.
SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
JSP
JSP

JavaServer Pages (JSP) allow the development of dynamically generated web pages. It uses the Java programming language; JSP pages are translated into servlets at runtime, with each servlet being cached and reused until the JSP is modified. JSP allows Java code to be interleaved with static web markup content, so the resulting page can be compiled and executed on the server to deliver the content.

16K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo