在PersonBusinessImpl类中定义的一个方法:去检查用户名是否已经存在
在一个personRegist.jsp里:
在js文件里:
在dwr.xml里
spring里也有这个bean了.
有个奇怪的地方就是在无论我再在PersonBusinessImpl类中加上什么样的方法,都没法再暴露出来.我那个
checkPersonUserName()就是后来加上去的额.
服务器也重启过了的!
一下午就为这个问题,头都有点疼了.. :(
public String checkPersonUserName(String personUserName) throws Person_LogonException {
PersonInfo pi = null;
try {
pi = (PersonInfo) personInfoDAO
.findByPersonUserName(personUserName).get(0);
} catch (IndexOutOfBoundsException ex) {
return "no";
}
return "yes";
}
在一个personRegist.jsp里:
<html:text property="personUserName" onblur="checkPersonUserName(this.value);"/>
在js文件里:
function isHasPerson() {
document.getElementById("noUserError").innerHTML = "检查中...";
var userName = document.getElementsByName("personUserName");
js_person.checkPersonUserName(userName[0].value, isHasPersonTwo);
}
function isHasPersonTwo(date) {
var n = document.getElementById("noUserError");
if (date == 'no') {
n.innerHTML = "该用户名可用!";
} else if(date == 'yes'){
n.innerHTML = "用户名已存在!";
} else{
n.innerHTML = "";
}
}
在dwr.xml里
<dwr>
<allow>
<create creator="spring" javascript="js_person">
<param name="beanName" value="personBusiness"/>
</create>
</allow>
</dwr>
spring里也有这个bean了.
有个奇怪的地方就是在无论我再在PersonBusinessImpl类中加上什么样的方法,都没法再暴露出来.我那个
checkPersonUserName()就是后来加上去的额.
服务器也重启过了的!
一下午就为这个问题,头都有点疼了.. :(