I'm having a problem with Struts. It's not recognizing a bean, even though it's defined one line above
I have this code
<logic:iterate id="com" name="Handler" property="commandList">
23: <optgroup id="${com.id}" style="display:none;">
24: <logic:iterate id="rem" name="com" property="remotes">
25: <option value="${rem.id}"><bean:write name="rem" property="name"/></option>
26: </logic:iterate>
27: </optgroup>
28: </logic:iterate>
and I get the following error in line 25:
javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "rem" in any scope
Which does not make sense, because the bean is defined just above on line 24
Any ideas? Thanks
As you state, the syntax of your code is correct. My guess is that one of the
remotes
bean's object is a null value. In that case, according to struts1 reference :The
<bean:write name="rem" property="name"/>
tag will be executed, but rem won't exist in any scope. Check for null values in your Array/List/Map/etcremotes
, or add a test using the<logic:present>
tag.