Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL with Struts

 
Ralf Schneider
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to access an indexed property inside a <logic:iterate> tag.

<logic:iterate id="col" indexId="i" name="sheetForm" property="cols"
type="de.fortu.ccdata.sheet.Column">
...
<util esignrule rule="${bean.editable[i] == false}" styleClass="readonly"/>
...
</logic:iterate>

The class behind "bean" has an ArrayList with a getter method

public boolean getEditable (int index)

The code above results in an exception saying:
javax.servlet.jsp.el.ELException: Unable to find a value for "editable" in object of class "de.fortu.ccdata.tree.LeaveNode" using operator "."

How do I have to modify my code to access the i-th element of that ArrayList?

Thanks,
Ralf.
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should write a method for your bean that returns an ArrayList that takes no arguments. Then, you should loop through the elements in the ArrayList and call the getEditable() method on them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic