struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tom tom <>
Subject Re: S2 life cycle
Date Wed, 04 Apr 2007 02:31:29 GMT
Actually the two concerns I stated in my previous mail
were regarding the ScopedModelDriven

Anyhow I am proceeding with ScopedModelDriven assuming
I can achieve the two concerns I have even with

How can I have a reference to the form class inside
the action class. I did the following 

1) Wrote a action class which implements
ScopedModelDriven interface, the argo is not null
inside setModel(Object arg0)method in the action class
but I cant cast into test.TestForm (pojo)

2) Wrote a seperate form class (pojo) e.g

3) defined interceptor as follows in struts.xml

<action name="test"
<interceptor-ref name="testForm"/>

and interceptor declaration as follows

<interceptor name="testForm"
<param name="scope">session</param>
<param name="name">examForm</param>
<param name="className">test.testForm</param>

How can I cast the model to test.testForm, am I doing
something wrong here.

Basically I want to refer to testForm and get and set

Should the TestForm implement some interface/class.


--- Mark Menard <> wrote:

> On 4/3/07 8:13 PM, "tom tom" <>
> wrote:
> > 1) Will introspecttion works as in struts 1.x
> > (automatic population from the jsp form fields,
> > provided the pojo got necessary setters and
> getters.
> Yes. If you have a property foo on your action (ie:
> setFoo (Object in) ),
> then a text field in your jsp like so:
>     <s:textfield name="foo" />
> Will populate that property of your action.
> > 2)How about the execution of validate method as
> per
> > struts 1.x, in struts 1.x Action form has the
> validate
> > method which will fire before the control delegate
> to
> > the Action class.
> You can implement the
> com.opensymphony.xwork2.Validatable interface so
> handle validation. Alternatively you could explore
> the validation framework,
> and use XML files to manage the validation.
> I think if you're sharing the form between multiple
> actions that using a
> validate method might be easier. You could put the
> validate() in a super
> class and then implement a different execute() in
> each descendant.
> > Can I achieve the above using ScopedModelDriven
> > mechanism.
> You can work ScopedModelDriven into it.
> Mark
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Expecting? Get great news right away with email Auto-Check. 
Try the Yahoo! Mail Beta. 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message