日期:2014-05-19  浏览次数:20693 次

求解:使用ssh框架,为何调试时得不到画面上输入的值?
ssh框架是自己用eclipse搭建的,断点调试时发现model里的msg的值为null,不知道为什么画面输入了值却传不到model中?求高手提示哈。
-------------ACTION类---------------
public class TESTACTION extends ActionSupport {
private static final long serialVersionUID = 1L;

private TESTMODEL model;
@Override
public String execute() throws Exception {
if ("badBoy".equals(this.model.getMsg())){
return ActionSupport.SUCCESS;
}else
{
return ActionSupport.ERROR;
}
}

public TESTMODEL getModel() {
return model;
}

public void setModel(TESTMODEL model) {
this.model = model;
}
}
----------model类---------------------
public class TESTMODEL {
private String msg;

public String getMsg() {
return msg;
}

public void setMsg(String msg) {
this.msg = msg;
}

}
-----------------jsp-----------------
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-31j">
<title>TestCase</title>
</head>
<body>
<s:form action="helloAction" method="post">
<input type="text" name ="msg"></input>

<input type="submit" name ="submit" value="commit"></input>

</s:form>

</body>
</html>

------解决方案--------------------
这里<input type="text" name ="msg"></input>
换成<input type="text" name ="model.msg"></input>