<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!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=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="${pageContext.request.contextPath }/Demo2Action">
用户名:<input type="text" name="name"/><br>
<input type="submit" value="提交">
</form>
</body>
</html>
package cn.itheima.c_param;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.util.ValueStack;
import cn.itheima.bean.User;
public class Demo2Action extends ActionSupport{
private User user = new User();
public String execute() throws Exception {
ValueStack vs = ActionContext.getContext().getValueStack();
vs.push(user);
System.out.println(user);
return SUCCESS;
}
@Override
public String toString() {
return "Demo2Action [user=" + user + "]";
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
在网页输入后控制台输出的是
cn.itheima.bean.User@2312484f
cn.itheima.bean.User@5fa62c70
cn.itheima.bean.User@2db8d881
这样的内容 请问如何结局。