| 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
|
 |
 |
|
|
subject: How to retain the values after page refresh.
|
|
|