Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: [S2] How to separate Action from "FormBean"

Dariusz Wojtas

2007-01-07

Replies:

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


On 1/7/07, uni@(protected):
> I just took a look at the tutorials of Struts 2 today. As a Struts 1 user, I
> don't like form beans that mostly copy your business data beans. In Struts 2,
> you don't need form beans anymore, but the tutorial states that you have to
> implement an execute() method into your business bean. Actually, what I would
> prefer is an Action class, that just references the form bean, i.e., I can use
> my business bean unchanged but only have to link them to an action. Is this
> possible in Struts 2 and how do I achieve this? Further, is are there any
> plans/release dates for a book on Struts 2?
>
> Cheers,
>
> Thorsten

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.