早教吧 育儿知识 作业答案 考试题库 百科 知识分享

采用Struts2框架,完成下述简单任务(项目):实现用户注册功能.要求如下:一、详细写出项目实现步骤,

题目详情
采用Struts2框架,完成下述简单任务(项目):实现用户注册功能.要求如下:一、 详细写出项目实现步骤,
▼优质解答
答案和解析
开发工具eclipse:
1 .新建web项目,在webcontent/web-inf/lib 目录下导入struts2jar包
2 .在src下新建一个struts.xml文件
3 .配置web.xml 加入如下:
action
org.apache.struts.action.ActionServlet
config
/WEB-INF/struts-config.xml
debug
3
detail
3
0
action
*.do
4.新建三个页面首页,成功页面
index.jsp
success.jsp
注册成功
5.写action
public void RegisterAction extends ActionSupport{
  private Strring username;
private String password;
public void setUsername(String username){this.username = useranme;}
public String getUsername() {return username;}
//..省略password set get
public void execute(){
//向数据库啊插入数据,或者模拟一个即可
return SUCCESS;
}
  }
5.配置struts.xml
/success.jsp
/index.jsp
6.wancheng