I'm trying to find out how to make a radio button checked by default when using jsp and struts 1.1 with custom tag.
When i write my code this way :
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
....................................................................
<html:radio property="operazione" value="addizione" checked="checked">Addizione</html:radio>
<br />
eclipse say :
Undefined attribute name "checked"
and when i try to run this code on my server Tomcat this is what i get:
Attribute checked invalid for tag radio according to TLD
I've read this q/a but it involves JavaScript... Can you help me?
That doesn't involves javascript. All you need to do is set the property value in the respective action form. While loading the page, set the actionForm.property=value
in the action class. If you required in javascript,
(function() {
// Set the value on loading the page
document.getElementByID("elementID").value=1;
})();
Hope this helps.