lundi 12 juillet 2021

How to make JSP input checkbox checked by default?

I have a checkbox in JSP, which consists of a HashMap<String, String>, e.g.,

"1", "Name"
"2", "Age"
"3", "Gender"

Now I want the first entry be checked by default, how should I write the if test code? The current code is as follows:

<input type="checkbox" name="params" value="<s:property value="#param.key"/>"
<s:iterator value="params" var="app">
<s:if test="???">
onclick="return false"
checked="checked"
</s:if>
</s:iterator>/>
&emsp;<s:property value="#param.value"/>



Aucun commentaire:

Enregistrer un commentaire