Some folks may be as pig-headed as me or may need to use LazyDynaBeans
as they are translating
from struts1 to struts2. After fooling around, I figured it out but it
is pretty clear to me this is not the way to go.
Below is a simple example.
public final class MyAction extends ActionSupport implements ModelDriven{
private LazyDynaBean f = new LazyDynaBean();
public String execute() throws Exception {
String[] text_field = (String[])f.get("text_field");
//do something with the text_field that came from LazyDynaBean
as a String array
return SUCCESS;
}
public Object getModel(){
return f;
}
}
<s:form action="MyAction">
<s:textfield name="map.text_field" />
<s:submit />
</s:form>
<validators>
<field name="map.text_field">
<field-validator type="required">
<message>Text Field is required.</message>
</field-validator>
</field>
</validators>
There were 2 things that bit me:
1. You have to get the field name from map.text field so that
s:textfield can get it from the "map" on the valuestack and
2. The textfield seems to get a String[] rather than a String and I
don't have any idea how to do it differently.
mas
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]