Ext与Struts2结合使用
Ext js2.2登陆(struts2+json)方法
1、struts2类包
Commons-logging-1.0.4.jar
Freemarker-2.3.12.jar
Ognl-2.6.11.jar
Struts2-core-2.1.2.jar
Xwork-2.1.1.jar
Commons-fileupload-1.2.1.jar
Commons-io-1.3.2.jar
2、web.xml
3、struts.xml
4.1 html、js分离模式
Login.jsp源码
Login.js源码
6、loginAction.javapackage org.ext.service; public class loginAction { private String username; private String password; private String jsondate=""; public String getUsername() { return username; } public String getJsondate() { return jsondate; } public void setJsondate(String jsondate) { this.jsondate = jsondate; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String execute() throws Exception { if(username.equals("zjw") && password.equals("1234")) { this.jsondate="{success:true}"; } else { this.jsondate="{failure : true}"; } return "success"; } }