struts2注解求助
我定义了一个接收vchangpwd.jsp请求的action,代码如下:
package com.newland.gxbc.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.InterceptorRefs;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import com.newland.gxbc.domain.ChangePwdFacade;
import com.opensymphony.xwork2.ActionSupport;
/**
* 修改操作员登录密码
*
* @author xianjiang
*
*/
@Scope("request")
@Namespace("/login")
@ParentPackage("default")
@InterceptorRefs(@InterceptorRef("basicStack"))
@SuppressWarnings("unchecked")
public class ChangePwdAction extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = 5668033529924546285L;
private static final Log logger = LogFactory.getLog(ChangePwdAction.class);
private String oldPwd;
private String newPwd;
private String newPwd1;
static {
System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<11111");
}
@Autowired
private ChangePwdFacade changePwdFacade;
@Action(value="changepwd", results = {
@Result(name = "success", location = "/login/login.jsp", type = "redirect"),
@Result(name = "none", location = "/login/login.jsp", type="redirect") })
public String changeOperPwd(String oldPwd, String newPwd, String newPwd1){
System.out.println("a123");
HttpServletRequest request = ServletActionContext.getRequest();
HttpSession session = request.getSession();
String userId = (String) session.getAttribute("userId");
int ret = changePwdFacade.changePwd(userId, oldPwd, newPwd);
if (ret == 0) {
return SUCCESS;
} else {
return NONE;
}
}
public String getOldPwd() {
return oldPwd;
}
public void setOldPwd(String oldPwd) {
this.oldPwd = oldPwd;
}
public String getNewPwd() {
return newPwd;
}
public void setNewPwd(String newPwd) {
this.newPwd = newPwd;
}
public String getNewPwd1() {
return newPwd1;
}
public void setNewPwd1(String newPwd1) {
this.newPwd1 = newPwd1;
}
}
现在的问题是请求提交后程序未能进入changeOperPwd函数,请有经验的朋友给指点下,是不是哪里还需要什么配置?