如何在 Struts 标签的属性中使用 Scriptlet 变量?

How to use a Scriptlet variable in an attribute of a Struts tag?

listBean 已经填充了数据 这就是我想要实现的目标:

<html:checkbox name="listBean" 
        property="checked" indexed="true" 
        disabled="listBean[i].disabled" />

这是我尝试过的:

    <bean:define id="disabledVal" name="listBean" property="disabled"/>
    <html:checkbox name="listBean" 
    property="checked" indexed="true" 
    disabled="<%=disabledVal%>" />

此代码抛出 jsp 错误:

BWEB004062: Unable to compile class for JSP: JBWEB004060: An error occurred at line ### : 119 in the jsp file: .jsp The method setDisabled(boolean) in the type BaseHandlerTag is not applicable for the arguments (Object) 116: codeFonctionnalite="<%= NAME %>"> 117: 118: 119: 122: JBWEB004060: An error occurred at line: 136 in the jsp file: .jsp The method setDisabled(boolean) in the type BaseHandlerTag is not applicable for the arguments (Object) 133: 135: 136: 138: 139: JBWEB004211: Stacktrace:'**

使用 EL 而不是 scriptlet 工作正常 使用这个 ${disabledVal} 而不是 <%=disabledVal%> :

<bean:define id="disabledVal" name="listBean" property="disabled"/>
<html:checkbox name="listBean" property="checked" indexed="true" 
disabled="${disabledVal}" />