Hi,

can we see your struts.xml?

Thanks,

Nuwan.


----- Original Message ----- From: "Paul Saumets | Merge" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Tuesday, February 27, 2007 2:50 PM
Subject: Struts 2 Action Classes (HELP!)


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]

Reply via email to