This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Whoever got anywhere by being normal? Just ask this exceptional tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic