当我在 Struts 2 中提交表单时,ERROR
当devMode
设置为true
. 虽然这不会影响我的功能,但不确定为什么会发生这种情况。
//错误信息
14:34:54,748 ERROR [com.opensymphony.xwork2.interceptor.ParametersInterceptor] (http-localhost/127.0.0.1:8080-1) ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'x' on 'class com.abc.LoginAction: Error setting expression 'x' with value '[Ljava.lang.String;@154cfc5'
14:34:54,749 ERROR [com.opensymphony.xwork2.interceptor.ParametersInterceptor] (http-localhost/127.0.0.1:8080-1) ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'y' on 'class com.abc.LoginAction: Error setting expression 'y' with value '[Ljava.lang.String;@114b526'
下面是代码片段
// Login JSP
<s:form action="login">
<table>
<tr><td>UserName : </td><td><s:textfield name="userid"/></td>
<tr><td>Password : </td><td><s:password name="password"/></td>
<tr><td></td><td><s:submit value="Submit" /></td>
</table>
</s:form>
Action
处理表单提交的类
public class LoginAction implements ModelDriven<LoginForm> {
private LoginForm theForm = new LoginForm();
public LoginForm getModel() {
return theForm;
}
public String execute() throws Exception {
-----
-----
}
}
// POJO used for data binding.
public class LoginForm {
private String userid;
private String password;
// Setters and Getters
}