This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Struts and the fly likes Defining a bean to point to an object returned from a method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Defining a bean to point to an object returned from a method" Watch "Defining a bean to point to an object returned from a method" New topic
Author

Defining a bean to point to an object returned from a method

Raj Kesavan
Greenhorn

Joined: Oct 08, 2010
Posts: 4
JSP Code snippet:

<logic:notEmpty name="currentControl" property="selectedRoles">
<logic:iterate id="roleCd" name="currentControl" property="selectedRoles" type="java.lang.String">
<% ControlRoleInfo currentRole = currentControl.getCurrentRole(roleCd); %>

<span class="bold">Date:</span> 
<bean:write name="currentRole" property="date" /><br>
</logic:iterate>
</logic:notEmpty>

Basically, I have here an iteration within an iteration. The object retrieved in the outer iteration has a number of objects of the same class type and it has a public method getCurrentRole that is used to figure out which object is relevant during each pass of the inner iteration. I could not find a way to use a bean:define tag to point to the object returned by this method call, and my bean:write tag cannot see the currentRole object initialized in the scriptlet shown above. Though I realize I can just use scriptlets all the way here instead, I want to use struts tags as much as possible in my code for consistency with existing code.

I look forward to seeing your ideas on how to achieve this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Defining a bean to point to an object returned from a method
 
Similar Threads
Websphere5.0.1.2 Struts
How to Introduce a Button That Controls All Other Links in a Web Page
Problem in iterating in tiles using struts iterate.
about logic:iterate and bean:write tag
JSP Radio button value retrieval