Could we explain this good example then? http://cwiki.apache.org/S2WIKI/struts-2-spring-2-jpa-ajax.html
Here we can see there is a form (index.jsp) calling the save() action on the PersonAction class. The first call on the save action is the service.save(person). Where does the Person person object inside PersonAction get set? Somehow the Person setters are being called and I'm not understanding how those setters are automatically called yet my LoginAction setters where userName and userPassword are passed from the form are not?! Could anyone explain please? ;) -----Original Message----- From: Gabe Hamilton [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 27, 2007 11:44 AM To: Struts Users Mailing List Subject: Re: Struts 2 Action Classes (HELP!) I believe the Parameters Interceptor will call your setUserName() method. I would check that that interceptor is in the stack used for LoginAction. -Gabe On 2/27/07, Paul Saumets | Merge <[EMAIL PROTECTED]> wrote: > > I'm having some difficulty passing along params from my action forms with > Struts 2. I have a basic jsp form declared as follows: > > <s:form id="loginForm" action="executeLogin" validate="true" > nomespace="/"> > <s:textfield id="c_username" name="userName" required="true" /> > <s:password id="c_password" name="userPassword" required="true"/> > <s:submit name="login" key="button.login" /> > </s:form> > > executeLogin is correctly mapped to my LoginAction action class which > looks something like the following: > > public class LoginAction extends ActionSupport { > > private UserService service; > private String userName; > private String userPassword; > > // service injected via Spring > > public LoginAction(UserService service) { > this.service = service; > } > > public void setUserName(String userName) { > this.userName = userName; > } > > /* remaining setters & getters below */ > > public String execute() { > > Boolean ret = service.validateUser(getUserName(), > getUserPassword()); > > /// more follow up code here > } > } > > > My understanding of the Struts 2 framework is that when my action is > called the setters on the Action class will be called as well storing my > passed along form vars? Am I wrong on this? What exactly am I doing wrong? > Should I implementing sessionAware and then having to access the request > object? > > From reading the Mailreader example I see setters in for username and > password in the MailreaderSupport base class so I don't see why the above > isn't working. > > Would be great to get some feedback! > > Regards, > Paul --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]