日期:2014-05-17 浏览次数:20687 次
$(document).ready(function() { $("#submit").click(function() { var psw = $("#password"); var username = $("#username").val(); var password = hex_md5(psw.val()); alert(psw.val()+":"+password); $.post("Login.action",{"username":username},function(data){alert(data);}); alert("123"); } ); }
package com.action; import com.opensymphony.xwork2.ActionSupport; public class Login extends ActionSupport{ private String username; private String password; public String execute() throws Exception { return SUCCESS; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String catchinfo(){ System.out.println("进入action......"); System.out.println(username); System.out.println("离开action......"); return "zhongguo"; } }
<html> <head> <script type="text/javascript" src="<%=path %>/js/jquery-1.7.2.js"> </script> <script type="text/javascript" src="<%=path %>/js/md5.js"> </script> <script type="text/javascript" src="<%=path %>/js/login.js"> </script> </head> <body> <div align="center"> user login <br /> <br /> username: <s:textfield name="username"></s:textfield> <br /> <br /> password: <s:password name="password"></s:password> <br /> <br /> <s:submit value="提交" id="submit"></s:submit> </div> </body> </html>
进入action...... da 离开action...... 2012-7-6 16:26:59 com.opensymphony.xwork2.util.logging.jdk.JdkLogger error 严重: Could not find action or result /MyPrj/pages/Login.action No result defined for action com.action.Login and result zhongguo at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:375) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)