Keeping the result bean - Struggling with Struts:

J

Joe Smith

Hi,

I'm giving my first steps with struts.

Here's the situation: I have created a jsp (say result.jsp) that displays a
table with a set of data calculated in the action, and which has been stored
in a result bean. Normal.

But, in result.jsp, I want to include a link to other action (for instance,
to show a graphic) using the data of the calculated bean.

The only solution I've come up so far is to store the result bean in a
session, ussing an id (for instance, the current timestamp), and have
result.jsp show sth like:

a href="export.do?beanid=myid"

If I don't use an Id, a user that opens a different tab, and arrives to the
same result.jsp will erase the previous value, won't he?

Is there a standard solution to do this?
I don't like storing data in the session, because if my export.do isn't
called, I don't have a choice to remove it from there.

Any pointers are welcome.

Thanks!
 
R

Ryan Dillon

Sounds like you are on the right track. If I understood what you
correctly, then these suggestions might help:

*) If you want to store the result bean in the session, store it under
a constant name, ie "resultBean", rather than an id that changes. That
way you will have at most bean of that type in the session (try to
minimize session usage).

*) If the data is easily recalculated, then stick to the request scope
and recalculate/load the data on each request. This saves any data from
going into the session, and the additional calculation time will
probably not even be noticed by the user.

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top