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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> --
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to