Dariusz Wojtas wrote:
>
> Want to have a bean separate from the action and just reference it?
> Define your bean (whatever you want) and just declare it as a variable
> on your action.
> Nothing more.
> Add getter and setter.
>
> class MyAction ... {
> private MyBeanClass myBean;
>
> }
>
> in your JSP just prefix bean components with the bean name;
>
> <s:textfield name="myBean.title" ... />
>
> That's all :)
>
> Dariusz Wojtas
>
>
One other thing that's nice about Struts2/WW is that you can utilize the
ModelDriven interface on your action.
So your action is
public class MyAction implements ModelDriven {
private MyBean myBean = new MyBean();
public Object getModel() { return myBean; }
}
that way your form fields can still be referenced by
<s:textfield name="title" />
Also very useful when moving your properties from the action into a
model/domain object/value object/etc... because your front-end code does not
hae to change.
--
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)