No idea concerning my initial question, or is it too simple to bother ? ;)
Let's try again ... :)
----------------------------------------------------------------------------
---
Hello,
Let's say I want an ActionForm which represents a command Form, with a
nested List or Array of LineItem s.
It could be something like that, in the form of a basic ActionForm:
public class CommandForm extends ActionForm {
private String name = null;
private List lineItems = new LinkedList();
/**
* @return Map
*/
public LineItem getLineItemIndexed(int key) {
return (LineItem) lineItems.get(key);
}
/**
* Sets the lineItem.
* @param lineItem The lineItem to set
*/
public void setLineItem(int key, LineItem lineItem) {
this.lineItems.set(key, lineItem);
}
/**
* @return String
*/
public String getName() {
return name;
}
/**
* Sets the name.
* @param name The name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return Map
*/
public List getLineItems() {
return lineItems;
}
/**
* Sets the lineItems.
* @param lineItems The lineItems to set
*/
public void setLineItems(List lineItems) {
this.lineItems = lineItems;
}
}
For some (good) reason, the ActionForm scope is request.
- A first readAction.do fills the CommandActionForm with a name and two
lines of items and forwards to a page which sends the result to the browser
(all with <html:text> tags => the whole CommandActionForm properties are
sent back when form is submitted).
- The form is submitted by the browser, with something like that in the HTTP
Post :
name=MyCommand
lineItem[0].productName=Toluen
lineItem[1].productName=Tata
This scenario doesn't work at all.
I have tried to change setter/getter methods to (get/set)LineItemIndexed
without any more success.
I have tried with Maps instead, and had some more results, but still not
totally satisfactory.
(I have tried to solve this by using DynaActionForms instead, but faced some
other problems with setting manually the nested lists using the basic
DynaActionForm api ...)
Could you please tell me what the Struts idiomatic solution to this problem
is ?
Thanks in advance,
--
Laurent PETIT.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]