File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Pulling my hair out over this one! Indexing issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Reply locked New topic
Author

Pulling my hair out over this one! Indexing issue

mr Cranberry
Greenhorn

Joined: Jul 18, 2007
Posts: 5
OK this is driving me crazy and I'm about to give up...

I'm trying very hard to use the "indexed='true'" feature of struts to manage a very simple ArrayList of objects in a page. It displays just fin, and I've checked the html code and it's populating the indexed properties just fine. But, when I post the form to an action, the constructor on the form gets called just fine but what I can NOT seem to get to happen correctly, is the part where Struts uses reflection to populated the list with the data on the html page. I just don't get why that part isn't happening... any ideas?

Config excerpt:

<action path="/VehicleDisplay"
type="packagename.presentation.action.vehicle.VehicleDisplayAction"
name="VehicleMaintenanceForm"
scope="request"
validate="false">
<forward name="success" path="vehicle.maintenanceThirdParty"/>
</action>

<action path="/SaveVehicleInfo"
type="packagename.presentation.action.vehicle.SaveVehicleInfoAction"
name="VehicleMaintenanceForm"
scope="request"
validate="true">
<forward name="success" path="vehicle.maintenanceThirdParty"/>
<forward name="stay" path="/SetupNewAccount.do"/>
<forward nam

Form:

public class VehicleMaintenanceForm extends ValidatorForm {

private List vehicleList;

public VehicleMaintenanceForm() {
vehicleList=new ArrayList(4);
for (int i=0; i<4; i++) {
vehicleList.add( new TagDTO());
}
}

public List getVehicleList() {
return vehicleList;
}

public void setVehicleList(List vehicleList) {
this.vehicleList = vehicleList;
}

}

Jsp excerpt:

<html:form action="/SaveVehicleInfo">

<logic:iterate name="VehicleMaintenanceForm" property="vehicleList" id="lineItem" indexId="rowNum">
<tr class="oddd">

<td align="center">
<html:text name="lineItem" indexed="true" property="licPlate"/>
</td>

</logic:iterate>

A breakpoint and trace thru the action "SaveVehicleInfo" confirms that the list is empty and was never populated by the framework...

Any ideas anyone?? What piece am I missing here? Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Mr Cranberry,

There are a couple of housekeeping issues I need to bring up with you.

The first is that it's considered bad form to post the same question in more than one thread as you have done. Please post the question to only one forum and one thread. Otherwise, it wastes the time of those willing to respond.

The second issue is the name you have displayed. The name you are currently displaying does not meet the guidelines of the JavaRanch Naming Policy. In particular, the name you display must be a first and last name, and must not be obviously fictitious. Please change the Publicly Displayed Name in your user profile so that it meets the guidelines.

This may seem trivial to you, but it's an important part of the culture at JavaRanch, and we do appreciate your compliance with it.

I'm closing this tread because it's a duplicate. Anyone wishing to respond, please do so in this thread.
[ July 18, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pulling my hair out over this one! Indexing issue