I have a variable paramMap, the type is HashMap<String, String>, which has two elements:
{"1", "areaNo"}
{"2", "areaOrgNo"}
and the checkbox code of Struts2 is as follows:
<s:iterator value="paramMap" var="params" status="paramStatus">
<input type="checkbox" name="params" key_id="#paramStatus.index" value="<s:property value="#param.key"/>"
<s:if test="#paramStatus.index=0">
onclick=checkAreaNo()
</s:if>
The logic I want is when I check areaNo, areaOrgNo will be unchecked, how should I write the function checkAreaNo() within the <script></script>? I have written checkAreaNo() as follows, but it doesn't work:
<script>
function checkAreaNo() {
if ( $(input[key_id='1']).prop("checked") ) {
$(input[key_id='1']).prop("checked", false)
}
}
</script>
So, as I said in the commented answer to use OGNL to the plain html tag you should use
<s:property>tag or JSP EL.or