| Author |
display radio button as selected
|
Dave Jamz
Greenhorn
Joined: Sep 29, 2012
Posts: 8
|
|
Hi
I am trying to set the value of my radio buttons from my action form but in the jsp I am just seeing two unselected radio buttons.
I have tried both of the ways below in the jsp:
action form code:
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
|
I don't see any evidence that you are putting the checked attribute on any of the elements.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Dave Jamz
Greenhorn
Joined: Sep 29, 2012
Posts: 8
|
|
I was trying to set the value from the actionform
When private Boolean testRadio = false; I want the no radio button to be selected and when private Boolean testRadio = true; i would like the yes radio button selected
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
|
I don't understand what you are doing with the value attributes; those are usually static. But whatever, to cause a radio button to be checked, give it the checked attribute.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
This is more along the lines of what I'd do:This will place the checked attribute on the appropriate radio element.
I'd also recommend making use of the label element to make your buttons better behaved.
|
 |
Dave Jamz
Greenhorn
Joined: Sep 29, 2012
Posts: 8
|
|
Thanks
What do the question mark and colon do?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
ternary operator
You should review the EL specification.
|
 |
 |
|
|
subject: display radio button as selected
|
|
|