wood burning stoves*
The moose likes JSP and the fly likes How to keep selected radio button after page refresh Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to keep selected radio button after page refresh" Watch "How to keep selected radio button after page refresh" New topic
Author

How to keep selected radio button after page refresh

Sree Mami
Ranch Hand

Joined: Jul 13, 2006
Posts: 75
Hi all,

I have a radio button group with 3 radio buttons, when I select a particular radio button each one of them will transfer the control to another jsp page, performs some calculations and returns to the caller jsp page, but when I return my radio button is not checked. How can i keep it selected.

I tried taking the value of the radio button in a string in the jsp page where I am doing some calculations and again setting the radio button value in a hidden field, when I return to the caller jsp page I am trying to write jsp code in the radio button value property as:





where hiddenfiled is the hidden field name in the other jsp page.

How can i keep my radio button selected even after page refresh. Please guide me.
[ August 11, 2006: Message edited by: Sree Mami ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You would have to set th value with cookies and than check the cookie onload to see if it needs to be selected.

Eric
Sree Mami
Ranch Hand

Joined: Jul 13, 2006
Posts: 75
Hi Eric

Can you post me a sample code for that?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

If you're doing this with JSP, there's no need for cookies, the value of the request param is still available when the JSP is being processed and you should be able to use it to set the "checked" attribute.

I've moved this to the JSP forum for any further discussion.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

when I select a particular radio button each one of them will transfer the control to another jsp page, performs some calculations and returns to the caller jsp page,


Your language is very imprecise here. How are the transitions from resource to resource being made? forwards? redirects?

Without these details, it will be difficult to help you out.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to keep selected radio button after page refresh
 
Similar Threads
using html:radio
How to dynamically "Check" the radio button based on condition
Using Struts Creating the Radio Button for gender
radio buttons selection
Default radio button not working