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 indexed property 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 "indexed property" Watch "indexed property" New topic
Author

indexed property

sanju sreedharan
Ranch Hand

Joined: Nov 25, 2008
Posts: 48
Hi all,

We're having a problem involving indexed properties in a form bean. This is the code of our form bean:


code:
--------------------------------------------------------------------------------

public class ManageRouteTemplatesForm extends ActionForm implements Serializable { /** * */private static final long serialVersionUID = 1L;private ArrayList<Dock> docks;private ArrayList<String> descriptionList;private ArrayList<RouteTemplate> routeTemplates;private String selectedDescription;private RouteTemplate selectedRouteTemplate;private RouteTemplate routeTemplateToInsert; /** * Code for the getters and setters */}

--------------------------------------------------------------------------------



As you can see, we have an arraylist called routeTemplates. That arraylist contains a collection of beans. Here it is the code of that bean:


code:
--------------------------------------------------------------------------------

public class RouteTemplate implements Serializable{ /** * */private static final long serialVersionUID = 1L;private String txtRoute;private String txtDescription;private String txtCompany;private String txtExpectedArrivalHour;private String txtExpectedExitHour;private String txtDestinationDocks;private String txtCommentsScheduleAnalyst;private ArrayList<RouteDockTemplate> rdtList; /** * + getters and setters */

--------------------------------------------------------------------------------



We are trying to set values in rdtList objects using the logic:iterate tag:


code:
--------------------------------------------------------------------------------

<logic:iterate name="manageRouteTemplatesForm" property="routeTemplates" id="routeTemplates"><tr><td><html:text indexed="true" name="routeTemplates" property="txtCompany" size="12%" /></td><td><bean:write name="routeTemplates" property="txtRoute" /></td><td><html:text indexed="true" name="routeTemplates" property="txtDestinationDocks" size="12%" /></td><td><html:text indexed="true" name="routeTemplates" property="txtExpectedArrivalHour" size="12%" /></td><td><html:text indexed="true" name="routeTemplates" property="txtExpectedExitHour" size="12%" /><html:text indexed="true" name="routeTemplates" property="txtExpectedExitHour" size="12%" /></td><bean : Define name="routeTemplates" property="txtRoute" id="nameRoute"/><logic:iterate name="routeTemplates" property="routeTemplates.rdtList" id="routeTemplates.rdtList"><logic:equal name="routeTemplates.rdtList" property="txtRoute" value="<%= nameRoute.toString() %>"><td><html:text indexed="true" name="routeTemplates.rdtList" property="txtDockArrivalHour" size="12%" /></td><td><html:text indexed="true" name="routeTemplates.rdtList" property="txtDockExitHour" size="12%" /></td></logic:equal></logic:iterate>

--------------------------------------------------------------------------------



We can see the values in our jsp but when we try to set a new value in the form bean, we are unsuccesful. The values remain as they were originally. We've been looking everywhere but we just don't know how get things working.

Can anyone give us a hand? Thanks in advance.
[ November 29, 2008: Message edited by: Bear Bibeault ]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I can't read that code; please edit or re-post.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: indexed property
 
Similar Threads
Indexed properties and logic:iterate problem
ArrayList inside an ArrayListVO
logic:iterate HashMap<Object,ArrayList>
Indexed properties problem- Confusing
can't get indexed form property to work.