2016-03-24 22:25 GMT+01:00 José Antonio Delgado Trujillo <jadt...@gmail.com>: >> >> You must define also scope="prototype" as Struts actions cannot be singletons > > There is nothing about that in the tutorial > https://cwiki.apache.org/confluence/display/WW/Spring+and+Struts+2 > <https://cwiki.apache.org/confluence/display/WW/Spring+and+Struts+2>
Ups.... it's a mistake, I will fix it. Actions cannot be singletons as they must be created on each request. If you will have them as singletons they will share state between requests/users and this can produce unpredictable problems >> You shouldn't mix Struts versions. >> > Sure but there is not 2.3.28 version to struts-spring-plugin. > The new time i’ll use the lasted version 2.5 of the arquetype. it's there http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.struts%22%20AND%20a%3A%22struts2-spring-plugin%22 >> Can you share struts.xml as well? >> > Upss!! > I found the mistake, a question of uppercase (in the struts.xml the name of > the class action began with lowercase). I’m stupid, i realised when i saw the > debug error. SORRY for your time !!! > Now it runs and without the scope. > > <?xml version="1.0" encoding="UTF-8" ?> > <!DOCTYPE struts PUBLIC > "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" > "http://struts.apache.org/dtds/struts-2.3.dtd"> > <struts> > > <constant name="struts.devMode" value="true"/> > <constant name="struts.ui.theme" value="KUTheme"/> > > > <package name="basicstruts2" extends="struts-default"> > > > > <action name="index"> > <result>/index.jsp</result> > </action> > > <action name="edit" class="pfc.struts2.form.action.EditAction" > method="input"> > <result name="input">/edit.jsp</result> > </action> > > <action name="save" > class="pfc.struts2.form.action.editAction" method="execute"> > <result name="success">/thankyou.jsp</result> > <result name="input">/edit.jsp</result> > </action> > </package> > > </struts> It's ok but you must use action's bean id instead of class name in struts.xml, as it was shown in the tutorial <action name="edit" class="editAction" method="input"> <result name="input">/edit.jsp</result> </action> it must be that way as Struts will ask Spring to create a bean based on "class" attribute - Spring will create an action using just a full class name but this isn't what you want sometimes, ie. you can have the same action class used twice but with different dependencies that's why you should use "editAction" in "class" attribute. Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org