This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes How to retain the values after page refresh. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "How to retain the values after page refresh." Watch "How to retain the values after page refresh." New topic
Author

How to retain the values after page refresh.

sahithi mohan
Greenhorn

Joined: Feb 13, 2012
Posts: 9
I use java script in jsp to display the UI page.
How can get retained value of radio button after the submission of page.

The code is as follows:
In JSP page:
<td><input type="radio" name="select" value="0" checked>Save
<input type="radio" name="select" value="1">Import</td>

function Perfom()
{


function importTemplate()
{

if(document.actionForm.select[0].checked == true)
{
document.actionForm.action="save.action";
document.actionForm.submit();
}
else if(document.actionForm.select[1].checked ==true)
{
document.actionForm.action="import.action";
document.actionForm.submit();

}
}


What are changes do i need to do fro retaining radio button values?
Nicola Garofalo
Ranch Hand

Joined: Apr 10, 2010
Posts: 308
The servlets that get the radiobutton value could store it into session.

in the servlet(s)



Anyway you need to modify jsp code, something like



Bye,
Nicola
sahithi mohan
Greenhorn

Joined: Feb 13, 2012
Posts: 9
Thanks for your reply Nicola Garofalo .
But the thing is we don't use Servlets.
And we use Struts 2.
Nicola Garofalo
Ranch Hand

Joined: Apr 10, 2010
Posts: 308
well, you could do the same thing in your action(s)
sahithi mohan
Greenhorn

Joined: Feb 13, 2012
Posts: 9

request.getSession().setAttribute("radiovalue",request.getParameter("select"));

We can't use this Struts, right.
So i tried with


getSessionMap().put("BUTTON", getButton());

But still it's not working.
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188



use this to reset the checkboxes
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to retain the values after page refresh.
 
Similar Threads
how show values in jsp from getting database
how to get form parameters data to a servlet?
How to update a image using servlet?
How can I set a form name in a jsp page using <html:form> tag ?
accessing jsp array variable in javascript