Yes I know we can do this, but the argument is the previous struts ActionForm sharing across many action classes is achieved by ScopedModelDriven<T> in Struts 2.
Having session scoped beans as members in action classes doesnt sound as a good MVC pattern to me. If there is a infrastructure in place why should we manuanlly do this session.setAttibute etc. I am bit confused. Mine it works just that the values get reset all the time eventhough in struts.xml state form as a session scoped value. I believe ScopedModelDriven<T> is a cleaner approach if it works, --- Harring Figueiredo <[EMAIL PROTECTED]> wrote: > tom: > > I have not experience with the ModelDrivenInterface. > > What is that you are trying to do? (It it is to keep > a bean around to share > between action invocations, have you tried this? > > class FirstAction extends ActionSupport{ > > public String execute(){ > Bean bean = new Bean(); > bean.setWhaterver(...); > session.setAttribute("MY_BEAN", bean); > } > > } > > > class SecondAction extends ActionSupport{ > > public String execute(){ > Bean bean = (Bean)= > session.getAttribute("MY_BEAN"); > bean.getWahtever(); > } > > } > > Is that what you want to do? > > Thanks, > > Hf > > > On 4/11/07, tom tom <[EMAIL PROTECTED]> wrote: > > > > Works but the values get reset all the time, > doesnt > > stay in the session scope, if I update form in the > one > > action class and if I try to retrieve from the > other > > action class the values has been lost. > > > > > > > > Should I have to do any extra things > > > > > > --- Dave Newton <[EMAIL PROTECTED]> wrote: > > > > > --- tom tom <[EMAIL PROTECTED]> 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: > > > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > Don't be flakey. Get Yahoo! Mail for Mobile > and always stay > > connected to friends. > http://mobile.yahoo.com/mail > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > -- > Sincerely, > > Harring Figueiredo > Sr. Software Engineer > Email: [EMAIL PROTECTED] > 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." > ____________________________________________________________________________________ Food fight? Enjoy some healthy debate in the Yahoo! Answers Food & Drink Q&A. http://answers.yahoo.com/dir/?link=list&sid=396545367 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]