• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to retain the values after page refresh.

 
sahithi mohan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
sahithi mohan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Nicola Garofalo .
But the thing is we don't use Servlets.
And we use Struts 2.
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, you could do the same thing in your action(s)
 
sahithi mohan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 188
Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


use this to reset the checkboxes
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic