struts-config.xml<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config>
  <data-sources />
  <form-beans >
    <form-bean name="loginForm" type="com.hua.struts.form.LoginForm" />  </form-beans>  <global-exceptions />
  <global-forwards />
  <action-mappings >
    <action
      input="/MyJsp.jsp"
      path="/loginin"
      type="com.hua.struts.action.LogininAction"
      validate="false" />
    <action
      attribute="loginForm"
      input="/MyJsp.jsp"
      name="loginForm"
      path="/login"
      scope="request"
      type="com.hua.struts.action.LoginAction"
      validate="false" />  </action-mappings>  <message-resources parameter="com.hua.struts.ApplicationResources" />
</struts-config>
jsp<%@ page language="java" pageEncoding="utf-8"%><%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
  <head>
    <html:base />
    
    <title>MyJsp.jsp</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script language="JavaScript">
var XMLHttpReq;
function createxmlhttpreq(){
if(window.XMLHttpRequest){
XMLHttpReq=new XMLHttpRequest();
}
else if(window.ActiveXObject)
try{

XMLHttpReq=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
XMLHttpReq=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){}
}
}
function sendlogin(){
var username=document.getElementById("username").value;
var url="loginin?username="+username;

createxmlhttpreq();
XMLHttpReq.open("GET",url,true);
XMLHttpReq.onreadystatechange=processResponse;
XMLHttpReq.send(null);

}
function processResponse(){
if (XMLHttpReq.readyState==4){
if (XMLHttpReq.status==200){
var tip=XMLHttpReq.responseText;
document.getElementById("tip").innerHTML="<font color='blue'>"+tip+"</font>";

}else
{
alert("您所请求的页面有异常!");
}
}
}

</script>  </head>
  
  <body>
    <html:form action="/login" method="post" focus="login">
      <table border="0">
        <tr>
          <td>Login:</td>
          <td><input type="text" name="login" id="username" onblur="sendlogin();"/></td>
          <td id="tip"></td>
        </tr>
        <tr>
          <td>Password:</td>
          <td><html:password property="password" /></td>
        </tr>
        <tr>
          <td colspan="2" align="center"><html:submit /></td>
        </tr>
      </table>
    </html:form>
  </body>
</html:html>
action public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws IOException {
// TODO Auto-generated method stub
String username=request.getParameter("username");
response.setContentType("text/html; charset=GBK");//设置返回内容的格式
PrintWriter out = response.getWriter();
TPersonDAO dao=new TPersonDAO();
if(dao.isexict(username)){
out.println("对不起,您所注册的用户名已经存在");

}else{
out.println("恭喜您,该用户名可以使用");
}

out.close();
return null;

}
}
调试的时候,说您所请求的页面有异常!这是什么问题,url的问题吗?数据库中有中文怎么处理!