差的资。料说是用ajax做?可是我不会ajax,ajax实在不会写了。。。
html部分
"
maxlength="50" />
javascript部分
后台数据库代码
@RequestMapping(value = "/repeat")
public void repeat(HttpServletRequest request, HttpServletResponse response, String custom_number) throws SQLException, IOException{
ConnectionSource connectionSource = DBUtil.getConnectionSource();
Dao dao = DaoManager.createDao(connectionSource,
zqbp_custom.class);
QueryBuilder where = dao.queryBuilder();
List list = where.where().eq("custom_number", custom_number).query();
if(list.size()==0){
}else {
response.getWriter().write("编号重复,请重新输入");
response.getWriter().close();
}
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
一个最简单的实现。
在线预览: https://code.levey.cn/ajax_check_name/
已注册用户名
levey和swnuvCode:
index.html
这里就是ajax了
check.js
这个页面用jsp实现就行了
check.php
1.你后台肯定得检索数据库。
2.前台直接判断就得发送请求。
3.你不想跳转,那只能是ajax发送请求。
你上网google一个例子,我就不当搬运工了,ajax就是个js发送http请求。
另外题主你说java?还是javascript?
jquery validation找个这个来用
当然自己做也没什么难的 最多做的丑一点