*
The moose likes Servlets and the fly likes Passing Data between JSPs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Passing Data between JSPs" Watch "Passing Data between JSPs" New topic
Author

Passing Data between JSPs

Kerry Shannon
Ranch Hand

Joined: May 08, 2001
Posts: 31
We are creating a payroll time entry application for the web.
Background:
We have the employee logging in, getting time information for the employee and storing it into objects. Then we ask the employee to pick between approving time (managers only) and entering time (all have this choice). We use a forward to send the employee to the time entry screen jsp, and we pass the initial objects on.
Problem:
When the employee enters time, we update the time vector. When we save the time data, then return to the time entry display, the modified time entry data does not display - it does show back on the screen what we changed in the time vector.
Question:
When you pass out an object, how can you update the object, or do you need to delete it and then re-read the data to pick up the changed information from the database?
Is it tied to how we may be keeping track of our session that we are in? How do you get the session ID and then pass it between jsp's?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
As long as all JSP are in the same "web application" you should automatically get the right session.
How are you passing objects around? In the session or in the request?
Is the "return to the time entry display" really calling the JSP again or is the browser using a cached copy?
Bill
Kerry Shannon
Ranch Hand

Joined: May 08, 2001
Posts: 31
We were using the session, but now are trying to use the request, because we thought we needed to do that because some of the 'value' methods are depricated so we are moving to the 'attribute' methods.
We believe the browser is using a cached copy, not calling the JSP again.
How should we be doing this?
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Kerry,
Please refer to this thread. Many suggestions are there. Especially by adding ?dummy=123 at end of URL. http://www.javaranch.com/ubb/Forum7/HTML/000520.html
regds
maha anna
Kerry Shannon
Ranch Hand

Joined: May 08, 2001
Posts: 31
Well, this seems to be working, although I'm not certain we did it this way.
Javaranch seems to have great information for our problems.
Thanks. You can close this topic.
Brett B Doehr
Greenhorn

Joined: Jun 04, 2001
Posts: 11
This might be a little off topic, but I have a somewhat related problem. I'm writing a login application that moves through a set of JSPs, and launches an applet on successful login. The concern is that if someone successfully logs in and runs the applet, then logs out, someone else could come up to the computer if the browser is left running and use the Back and Forward browser buttons to essentially relogin. It doesn't appear that the JSPs are re-executing when going back to a page using the browser buttons, based on some print statements I have. On logout I do a showDocument back to the initial login page, but the applet will re-execute if you use the Back button.
Is there a way to catch the browser Forward and Back button clicks in the JSP, so I can try to prevent someone reloading a successful login page? I tried the "no-cache" code from the thread that Maha Anna mentioned, but as I said above, it seems like the files aren't uncached (even when using ?dummy=123) since it's not really executing my JSPs to move between pages.
Thanks for any assistance/suggestions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing Data between JSPs
 
Similar Threads
Hard JTABLE Question
Struts and using methods from a service
Problem in refreshing the data..
Struts: ActionForm does not contain user data
some java interview Questions