Struts storing data into session , Struts 1.2.9

Posted on 2009-02-18
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 can i achieve this in my strtus 1.2.9 framwork????  

Thanks in advance
Question by:NiksStruts
    1 Comment
    LVL 6

    Accepted Solution

    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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Title # Comments Views Activity
    has22 challenge 11 56
    dividesSelf challange 15 58
    Spring Controller - inheritance in request parameter 3 29
    word0 challenge 4 37
    I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
    Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
    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.

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now