[Last Call] Learn how to a build a cloud-first strategyRegister Now


Struts storing data into session , Struts 1.2.9

Posted on 2009-02-18
Medium Priority
Last Modified: 2013-11-24
Hi Experts,

I have requirement like....there a drop down box which shows tables records...when user press add to list button ...the selected record will add to table grid which reside below in same page...
the records in grid stored temporary...when user select other record and press add to list button ..that record will also come to the table ...the total they become 2 records but they are temporary...if user moves to other page then those record will be lost....how can i achieve this in my strtus 1.2.9 framwork????  

Thanks in advance
Question by:NiksStruts
1 Comment

Accepted Solution

javaexperto earned 1500 total points
ID: 23671895
You need to store this data in a HttpSession. Remember how to get the session:

HttpSession session = request.getSession();

then  you add your attributes, in this case your query objects, they can be stored in a String or in another object.

session.setAttribute("name", "value");

remember setAttribute receives a String name and an object for the value.

when you want to display again your querys, just get the attribute from the session object:

String q = (String)session.getAttribute("name");

Good luck


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question