struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tom tom <j_lal...@yahoo.com>
Subject Re: S2 life cycle
Date Wed, 11 Apr 2007 02:35:31 GMT
Well.... I tried ScopedModelDriven<myForm> Yes it
works but the values get reset all the time, The form
is defined as it is in session scope.

What I did was
I got two action claases which extends
ScopedModelDriven<MyForm> I update the form value in
one action class and retrieve the value in the other
but it looks to me it has not been updated.


I have defined the interceptor as follows in
struts.xml


<interceptors>
<interceptor name="examForm"
class="com.opensymphony.interceptor.ScopedModelDrivenInterceptor"
>

<param name="scope">session</param>
 <param name="name">myForm</param>
 <param name="className">test.MyForm</param>
</interceptor>
</interceptors>


my Action class is 
public class ExamListAction implements
ScopedModelDriven<MyForm> {


and I updated the value as follows 

public void setModel(MyForm arg0) {
		
		
		arg0.setName("Updated Name");
		
	 
	}


When my next action class retrieves the value it
prints null,

Am I doing something wrong,

pls let me know how to proceed on this.

Thanks




--- Harring Figueiredo <harringf@gmail.com> wrote:

> Tom,
> 
> I forgot to mention that unlike S1, in S2 the action
> class does not have to
> be thread safe - The action class will be
> instantiated for each request, and
> thus it will have its own instance of the POJO or
> member variables.
> You can pass the "ActionForm", in our case, the POJO
> object to another
> action byt putting the pojo into the session object
> [session.setAttribute(..)]
> 
> There are 2 types of validation - 1) Using
> Validators. 2) Implementing a
> Validatable interface on your Action. Look at the
> links provided to you from
> previous email.
> 
> Hope this helps.
> 
> Harring
> 
> On 4/4/07, joey <realghost819@gmail.com> wrote:
> >
> > I prefer to achieve it by writing some java code
> than xml snippet.
> > Maybe migrating from struts1.x would do this.
> > If I just wanted to share more than one form
> within some actions,I must
> > declared more than one
> > interceptor.If I achieve it by only java code,I
> only need write a base
> > action and extend it.I can write
> > any get or set shared property methods in the
> desired scope.
> >
> > On 4/4/07, tom tom <j_lalith@yahoo.com> wrote:
> > >
> > > Thanks,
> > >
> > > Any samples or documenation around for me to
> refer.
> > >
> > > I followed this
> > >
> > >
>
http://struts.apache.org/2.x/docs/scoped-model-driven-interceptor.html
> > >
> > >
> > > but didnt work.
> > >
> > > Thanks
> > >
> > > --- Dave Newton <newton.dave@yahoo.com> wrote:
> > >
> > > > --- tom tom <j_lalith@yahoo.com> wrote:
> > > > > 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)
> > > >
> > > > At the very least I believe you should
> implement
> > > > ScopedModelDriven<T>, not just
> ScopedModelDriven,
> > > > and
> > > > provide typed accessors:
> > > >
> > > >
> > >
> > >
> >
>
http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/ModelDriven.html
> > > >
> > >
> > >
> >
>
http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/interceptor/ScopedModelDriven.html
> > > >
> > > > d.
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
>
____________________________________________________________________________________
> > > > Don't get soaked.  Take a quick peek at the
> forecast
> > > > with the Yahoo! Search weather shortcut.
> > > >
> http://tools.search.yahoo.com/shortcuts/#loc_weather
> > > >
> > > >
> > >
>
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > user-unsubscribe@struts.apache.org
> > > > For additional commands, e-mail:
> > > > user-help@struts.apache.org
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
>
____________________________________________________________________________________
> > > Don't get soaked.  Take a quick peek at the
> forecast
> > > with the Yahoo! Search weather shortcut.
> > >
> http://tools.search.yahoo.com/shortcuts/#loc_weather
> > >
> > >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail:
> user-help@struts.apache.org
> > >
> > >
> >
> 
> 
> 
> -- 
> Sincerely,
> 
> Harring Figueiredo
> Sr. Software Engineer
> Email: harringf@gmail.com
> Telephone: 941-256-0600
> 
> "We never become truly spiritual by sitting down and
> wishing to become so.
> You must undertake something so great that you
> cannot accomplish it
> unaided."
> 



       
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message