controlling display of data in jsp page

Posted on 2006-04-28
Last Modified: 2010-04-01
hi experts

I have a submit button in my jsp page and on submit it goes to the action class and displays the data. Displaying of data is
done in jsp and this peice of code in the jsp does that :

jsp code:


   if(session.getAttribute("logrepor") != null) out.println((String)session.getAttribute("logrepor"));


and i am setting it in the session in action class. like this

                session.setAttribute("logreportresult", lines.toString());

so when i hit submit button i see the data of -->   out.println((String)session.getAttribute("logrepor"));
in my jsp page
The problem is hereafter when ever the jsp page loads it shows me the data in  
 since it is set in session and its displaying it from session

is there any way i can change the code so that i can see -->  out.println((String)session.getAttribute("logrepor"));

only when i hit the submit button and not everytime the page loads

any responces greatly appreciated

Question by:jaggernat
    LVL 11

    Accepted Solution

    set it in request.

    request.setAttribute("logreportresult", lines.toString());

    and get it like

    LVL 11

    Expert Comment

    one more thing, if the page is getting load with the same action class.. u need to have different handling with the action class.
    May be one action to handle the submit and the other action class to handle the page load. Something like dispatch action will work great in this scenario.
    LVL 10

    Author Comment

    request works thanks

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Suggested Solutions

    It Is not possible to enable LLDP in vSwitch(at least is not supported by VMware), so in this article we will enable this, and also go trough how to enabled CDP and how to get this information in vSwitches and also in vDS.
    David Varnum recently wrote up his impressions of PRTG, based on a presentation by my colleague Christian at Tech Field Day at VMworld in Barcelona. Thanks David, for your detailed and honest evaluation!
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    746 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

    16 Experts available now in Live!

    Get 1:1 Help Now