ActionBean: public ActionForward doCheckUser(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws IOException {
Icp_zcForm icp_zcForm = null;
IIcp_zcService icp_zc = new Icp_zcServiceImpl();
String username="";
if(request.getParameter("username")!=null){
username = request.getParameter("username");
}
List list = icp_zc.getUserUnique(username, this.getServlet().getServletContext());
if(list!=null){
if(list.size()!=1){
System.out.println("Fail");
response.getWriter().print("您申请的用户名称已被占用");
return mapping.findForward("icp_first_zc");
}else{
System.out.println("Succ");
response.getWriter().print("恭喜您!您可以使用这个用户名!");
return mapping.findForward("icp_first_zc");
}
}
return null;
}
}JSCheckUser=function(ContextPath){
var username = (document.getElementById('icp_zc_1')).value;
if(username==""){
alert('用户名不能为空!')
(document.getElementById('icp_zc_1')).focues();
return false;
}
var pat=ContextPath+"/icp/icp_zc.do?method=doCheckUser&username="+username;
$.get(pat,null,function(responseTxt){
alert(responseTxt);});
}responseTxt拿回来了发出请求的网页的源码晕求各位大侠帮忙
HttpServletRequest request, HttpServletResponse response) throws IOException {
Icp_zcForm icp_zcForm = null;
IIcp_zcService icp_zc = new Icp_zcServiceImpl();
String username="";
if(request.getParameter("username")!=null){
username = request.getParameter("username");
}
List list = icp_zc.getUserUnique(username, this.getServlet().getServletContext());
if(list!=null){
if(list.size()!=1){
System.out.println("Fail");
response.getWriter().print("您申请的用户名称已被占用");
return mapping.findForward("icp_first_zc");
}else{
System.out.println("Succ");
response.getWriter().print("恭喜您!您可以使用这个用户名!");
return mapping.findForward("icp_first_zc");
}
}
return null;
}
}JSCheckUser=function(ContextPath){
var username = (document.getElementById('icp_zc_1')).value;
if(username==""){
alert('用户名不能为空!')
(document.getElementById('icp_zc_1')).focues();
return false;
}
var pat=ContextPath+"/icp/icp_zc.do?method=doCheckUser&username="+username;
$.get(pat,null,function(responseTxt){
alert(responseTxt);});
}responseTxt拿回来了发出请求的网页的源码晕求各位大侠帮忙
解决方案 »
- 请问我用MyEclipse建立的Servlet程序为什么不能正常运行
- servlet中相关问题
- Hibernate Criteria 查询的疑问
- java新手,求架构方案
- 一个数据岛的奇特问题??
- 高手才进来:Spring中对web.xml的配置
- hibernate两表关联,记录要求排序的问题
- 求助:java.io.NotSerializableException
- ear包是不是通用的?
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]将截断字符串或二进制数据。
- EhCache和OScache哪个好些啊
- 问个关于dao层的问题~
这个换成return null试试