aspose file tools*
The moose likes JSP and the fly likes display radio button as selected Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "display radio button as selected" Watch "display radio button as selected" New topic
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: 61601
    
  67

I don't see any evidence that you are putting the checked attribute on any of the elements.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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: 61601
    
  67

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: 61601
    
  67

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: 61601
    
  67

ternary operator

You should review the EL specification.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: display radio button as selected