日期:2014-05-16 浏览次数:20332 次
<script src="js/validate.js" type="javascript"> </script>
<script src="js/jquery-1.9.1.js" type="javascript"> </script>
<script language="JavaScript">
$(document).ready(function() {
$('#accountname').blur(function(){
var account = $('#accountname').val();
$.get('src/struts/action/CheckAccountName.action?','userid = '+ account,processData);
});
});
function processData(){
if(data=='exist'){
$('#accounthint').html('<p>该账号已经存在</p>');
}
else $(this).html('<p>该账号可以使用</p>');
}
public class CheckAccountNameAction extends ActionSupport{
private String userid;
private String result;
private AccountManagerImpl am = new AccountManagerImpl();
public CheckAccountNameAction(String userid) {
this.userid = userid;
}
@Override
public String execute(){
result = am.checkAccountName(this.userid);
//这个函数就是service层的函数
return result;
}