You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by tom tom <j_...@yahoo.com> on 2007/05/18 08:41:37 UTC

ScopedModelDriven issues

Hi,

Has any one successfull getting ScopedModelDriven with
session scoped form beans,

I tried several times and it failed, the values only
remains for request scope, it get reset each time.

Is this a bug.

Plese let us know how to proceed.

Thanks


 
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 

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


Re: ScopedModelDriven issues

Posted by Rubbinio <rs...@n-able.com>.
I had same issue. Make sure you do not do a new ModelClass() anywhere in your
action. Then it will work



Tracy12 wrote:
> 
> Hi,
> 
> Has any one successfull getting ScopedModelDriven with
> session scoped form beans,
> 
> I tried several times and it failed, the values only
> remains for request scope, it get reset each time.
> 
> Is this a bug.
> 
> Plese let us know how to proceed.
> 
> Thanks
> 
> 
>  
> ____________________________________________________________________________________
> Don't pick lemons.
> See all the new 2007 cars at Yahoo! Autos.
> http://autos.yahoo.com/new_cars.html 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ScopedModelDriven-issues-tp10677278p19579021.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


RE: [S2] ScopedModelDriven issues [newbie]

Posted by "Hodgins, Grant" <Gr...@SierraSystems.com>.
Based on the documentation I didn't think so.

The interceptor appears to be correctly persisting the object in the
session.  It just seems that the model is not being populated on form
submission.

Is there something obvious I should check to ensure that the model is
being properly populated?  Is it something to do with the getScopeKey()
method?

-----Original Message-----
From: Cory D. Wiles [mailto:kwylez@gmail.com] 
Sent: Saturday, September 29, 2007 9:12 AM
To: Struts Users Mailing List
Subject: Re: [S2] ScopedModelDriven issues [newbie]

Wouldn't you also have to include the SessionAware interceptor in your
"myForm" stack as well as implement the SessionAware Interface or is
that over kill for scopedModelDriven?

On 9/28/07, ghodgins <Gr...@sierrasystems.com> wrote:
>
>
> Does anyone have a working example using the scopedModelDriven 
> interceptor to work for a session bean?
>
> I've tried with the following:
>
> 1. define interceptor in struts.xml
> ...
>     <interceptors>
>       <interceptor name="myForm"
>
>
class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor"
>
>         &lt;param name="scope">session&lt;/param>
>         &lt;param name="name">myForm&lt;/param>
>         &lt;param name="className">model.MyFormBean&lt;/param>
>       </interceptor>
>     </interceptors>
> ...
>
> 2. define interceptor-ref for action(s) in struts.xml
>     <action ... >
>       <interceptor-ref name="myForm" />
>       ...
>     </action>
>
>
> 3. Action class extends ScopedModelDriven<MyFormBean>
>
> public class MyAction extends ActionSupport implements 
> ScopedModelDriven<MyFormBean> { ...
> private String scopeKey;
> private MyFormBean model;
> ...
>     public String getScopeKey() {
>         return scopeKey;
>     }
>
>     public void setScopeKey(String key) {
>         scopeKey = key;
>     }
>
>     public void setModel(MyFormBean model) {
>         this.model = model;
>     }
>
>     public MyFormBean getModel() {
>         return model;
>     }
> }
>
> 4. attempt to populate a property of MyFormBean via JSP form:
>
> <s:form ...>
>   <s:textfield name="model.property"/>
>   <s:submit />
> </s:form>
>
> With this setup, the model is persisted in the session, however, none 
> of my properties are populated or preserved in subsequent 
> actions/screens.
>
> I'm sure I'm missing something trivial or completely misunderstanding 
> something but any help is appreciated.
>
> Thanks,
> Grant
>
>
>
> Tracy12 wrote:
> >
> > Hi,
> >
> > Has any one successfull getting ScopedModelDriven with session 
> > scoped form beans,
> >
> > I tried several times and it failed, the values only remains for 
> > request scope, it get reset each time.
> >
> > Is this a bug.
> >
> > Plese let us know how to proceed.
> >
> > Thanks
> >
> >
> >
> >
> ______________________________________________________________________
> ______________
> > Don't pick lemons.
> > See all the new 2007 cars at Yahoo! Autos.
> > http://autos.yahoo.com/new_cars.html
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/ScopedModelDriven-issues-tf3776022.html#a1295024
> 8 Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


----Notice Regarding Confidentiality----
This email, including any and all attachments, (this "Email") is intended only for the party to whom it is addressed and may contain information that is confidential or privileged.  Sierra Systems Group Inc. and its affiliates accept no responsibility for any loss or damage suffered by any person resulting from any unauthorized use of or reliance upon this Email.  If you are not the intended recipient, you are hereby notified that any dissemination, copying or other use of this Email is prohibited.  Please notify us of the error in communication by return email and destroy all copies of this Email.  Thank you.

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


Re: [S2] ScopedModelDriven issues [newbie]

Posted by "Cory D. Wiles" <kw...@gmail.com>.
Wouldn't you also have to include the SessionAware interceptor in your
"myForm" stack as well as implement the SessionAware Interface or is that
over kill for scopedModelDriven?

On 9/28/07, ghodgins <Gr...@sierrasystems.com> wrote:
>
>
> Does anyone have a working example using the scopedModelDriven interceptor
> to
> work for a session bean?
>
> I've tried with the following:
>
> 1. define interceptor in struts.xml
> ...
>     <interceptors>
>       <interceptor name="myForm"
>
> class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor">
>         &lt;param name="scope">session&lt;/param>
>         &lt;param name="name">myForm&lt;/param>
>         &lt;param name="className">model.MyFormBean&lt;/param>
>       </interceptor>
>     </interceptors>
> ...
>
> 2. define interceptor-ref for action(s) in struts.xml
>     <action ... >
>       <interceptor-ref name="myForm" />
>       ...
>     </action>
>
>
> 3. Action class extends ScopedModelDriven<MyFormBean>
>
> public class MyAction extends ActionSupport implements
> ScopedModelDriven<MyFormBean> {
> ...
> private String scopeKey;
> private MyFormBean model;
> ...
>     public String getScopeKey() {
>         return scopeKey;
>     }
>
>     public void setScopeKey(String key) {
>         scopeKey = key;
>     }
>
>     public void setModel(MyFormBean model) {
>         this.model = model;
>     }
>
>     public MyFormBean getModel() {
>         return model;
>     }
> }
>
> 4. attempt to populate a property of MyFormBean via JSP form:
>
> <s:form ...>
>   <s:textfield name="model.property"/>
>   <s:submit />
> </s:form>
>
> With this setup, the model is persisted in the session, however, none of
> my
> properties are populated or preserved in subsequent actions/screens.
>
> I'm sure I'm missing something trivial or completely misunderstanding
> something but any help is appreciated.
>
> Thanks,
> Grant
>
>
>
> Tracy12 wrote:
> >
> > Hi,
> >
> > Has any one successfull getting ScopedModelDriven with
> > session scoped form beans,
> >
> > I tried several times and it failed, the values only
> > remains for request scope, it get reset each time.
> >
> > Is this a bug.
> >
> > Plese let us know how to proceed.
> >
> > Thanks
> >
> >
> >
> >
> ____________________________________________________________________________________
> > Don't pick lemons.
> > See all the new 2007 cars at Yahoo! Autos.
> > http://autos.yahoo.com/new_cars.html
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/ScopedModelDriven-issues-tf3776022.html#a12950248
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: [S2] ScopedModelDriven issues [newbie]

Posted by ghodgins <Gr...@SierraSystems.com>.
Does anyone have a working example using the scopedModelDriven interceptor to
work for a session bean?

I've tried with the following:

1. define interceptor in struts.xml
...
    <interceptors>
      <interceptor name="myForm"
       
class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor">
        &lt;param name="scope">session&lt;/param>
        &lt;param name="name">myForm&lt;/param>
        &lt;param name="className">model.MyFormBean&lt;/param>
      </interceptor>
    </interceptors>
...

2. define interceptor-ref for action(s) in struts.xml
    <action ... >
      <interceptor-ref name="myForm" />
      ...
    </action>


3. Action class extends ScopedModelDriven<MyFormBean>

public class MyAction extends ActionSupport implements
ScopedModelDriven<MyFormBean> {
...
private String scopeKey;
private MyFormBean model;
...
    public String getScopeKey() {
	return scopeKey;
    }

    public void setScopeKey(String key) {
	scopeKey = key;
    }
    
    public void setModel(MyFormBean model) {
	this.model = model;	
    }

    public MyFormBean getModel() {
	return model;
    }
}

4. attempt to populate a property of MyFormBean via JSP form:

<s:form ...>
  <s:textfield name="model.property"/>
  <s:submit />
</s:form>

With this setup, the model is persisted in the session, however, none of my
properties are populated or preserved in subsequent actions/screens.

I'm sure I'm missing something trivial or completely misunderstanding
something but any help is appreciated.

Thanks,
Grant



Tracy12 wrote:
> 
> Hi,
> 
> Has any one successfull getting ScopedModelDriven with
> session scoped form beans,
> 
> I tried several times and it failed, the values only
> remains for request scope, it get reset each time.
> 
> Is this a bug.
> 
> Plese let us know how to proceed.
> 
> Thanks
> 
> 
>  
> ____________________________________________________________________________________
> Don't pick lemons.
> See all the new 2007 cars at Yahoo! Autos.
> http://autos.yahoo.com/new_cars.html 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ScopedModelDriven-issues-tf3776022.html#a12950248
Sent from the Struts - User mailing list archive at Nabble.com.


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