81,092
社区成员
发帖
与我相关
我的任务
分享
<welcome-file-list>
<welcome-file>/WEB-INF/jsp/login/login.jsp</welcome-file>
</welcome-file-list>
<!-- Strut2 -->
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
struts.action.extension=do,jsp
struts.serve.static=false
<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%String path =request.getContextPath();
%>
<html>
<head>
<script type="text/javascript" src="${pageContext.request.contextPath}/struts/js/response.js"></script>
<script type="text/javascript" src="../../../../struts/js/request.js"></script>
<script type="text/javascript">
fuction showtips(str){
test();
abc();
}
/**
function showtips(str){
abc();
if(str.length==0){
document.getElementById("tips").innerHTML="";
return;
}
xmlHttp = request();
if(xmlHttp==null){
return;
}
alert($("username"));
var url="json/loginAjax.do";
var params ={username:document.getElementsByName("username").Value};
xmlHttp.open("POST",params,url,true);
xmlHttp.onreadystatechange=response;
xmlHttp.send(null);
}
function request() {
var xmlHttp;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
} catch (e) {
// Internet Explorer
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
alert("您的浏览器不支持AJAX!");
return false;
}
}
}
return xmlHttp;
}
function response(){
if (xmlHttp.readyState==4)
{
if (xmlHttp.status == 200) {
alert(xmlHttp.responseText);
} else {
alert("您所请求的页面有异常。");
}
alert(xmlHttp.responseText);
var data = eval(xmlHttp.responseText);
}
} **/
</script>
<style type="text/css">
.errorMessage{
color: red;
font-size: 9;
}
</style>
</head>
<body>
<form name="login" action="login.do" method="post" >
<table>
<tr>
<td>userName:</td><td><input name="username" type="text" onchange="showtips(this.value)"/></td>
<td id="tips"><s:fielderror><s:param>username</s:param></s:fielderror></td>
</tr>
<tr>
<td>password:</td><td><input name="password" type="password"/></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="submit"/></td>
</tr>
</table>
</form>
</body>
</html>
<script type="text/javascript" src="../struts/js/response.js"></script>
function abc(){
alert("");
}