Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

How to keep selected radio button after page refresh

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric

Can you post me a sample code for that?
 
Marshal
Posts: 67496
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Marshal
Posts: 67496
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic