This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Getting an exception while trying to check the radio button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting an exception while trying to check the radio button" Watch "Getting an exception while trying to check the radio button" New topic
Author

Getting an exception while trying to check the radio button

Dee Gee
Greenhorn

Joined: May 10, 2006
Posts: 10
Hi

I am getting an exception while trying to check the radio button.
The exception is:-

org.apache.jasper.JasperException: /request.jsp(39,4) Attribute checked invalid for tag radio according to TLD

Is the exception and the code is----------------------------
html:radio
value="Event is not recurring" property="recurring" checked="checked"
----------------------------------------------------------------

Please help me out.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If you look at The documentation for the html:radio tag you'll see that there is no checked property for this tag. If you want the button to show as checked when the JSP is displayed, set the property "recurring" of your form bean to "event is not recurring" before displaying the JSP. That's how all <html:xxx> tags work: They take their value from the ActionForm property.


Merrill
Consultant, Sima Solutions
Dee Gee
Greenhorn

Joined: May 10, 2006
Posts: 10
Hi

This didn't work.-----------------------
In form bean:
String recurring = "Event is not recurring";
------------------------------
In JSP:
html:radio
value="Event is not recurring" property="recurring"
---------------------------------------------------
One more thing how do you have html:checkbox selected.
And how can you put one of the html ption of html:select as the selected option?


Thank You
DG
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
When you say "didn't work", what do you mean?

I just tried this in a test page and it works great for me.

Here's the code:

testForm



And how can you put one of the htmlption of html:select as the selected option?


<html:select> works exactly the same way. If you populate the property of the form bean specified in the <html:select> tag with the value of the option you want selected, that option will show as selected when the page is displayed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting an exception while trying to check the radio button
 
Similar Threads
radio button
Keeping Radio selection
struts radio button default checked issue.
radio button using javascript DOM
get value from radio button