wood burning stoves 2.0*
The moose likes Struts and the fly likes Where to store data so that 2 JSP's can access it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Where to store data so that 2 JSP Watch "Where to store data so that 2 JSP New topic
Author

Where to store data so that 2 JSP's can access it

Aniket Khadke
Greenhorn

Joined: Jul 13, 2011
Posts: 29

Hi,
I am working on a school mgmt project. In one module when user clicks a link I want to display all admissions from DB. I am invoking a action class when link is clicked bt nt getting where to store the results I got from DB, so that another JSP should also access it. Any help is welcome.

Thanks is advance
Jinal Prakas Shah
Ranch Hand

Joined: Jun 20, 2012
Posts: 39
It quite simple. So let's suppose you want to store a String data. Here is How you can

Now in your jsp if you are using Struts 2 you can write this tag and it will work


I don't remember for Struts1 but I think it's bean:write or bean:message.

So the main thing is understand this thing very clearly. Struts works on Java beans. So create the beans you want to access and it can be directly used in the JSP.

Regards
Sreehari Pillai
Greenhorn

Joined: Jun 25, 2012
Posts: 2
You can create a bean as specified above and in struts-config.xml, specify scope="session". Then you can share the data which will persist through out the session
Aniket Khadke
Greenhorn

Joined: Jul 13, 2011
Posts: 29

Thanks Jinal,Shreehari & Bear. I tried the code and it is working fine. Bear, I will make sure this won't happen again.

Thanks once again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where to store data so that 2 JSP's can access it