package check;
import java.io.PrintWriter;
import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class CheckUserName extends HttpServlet
{
private String msgStr="";
//已注册名字列表
public String[] usernameList;
//响应Get请求函数
protected void doGet(HttpServletRequest request,HttpServletResponse response) throws
ServletException
{
String oprate=(String)request.getParameter("oprate");
String userName=(String)request.getParameter("userName");
try
{
if(oprate.equals("chkUser"))
{
response.setContentType("text/html;charset=GB2312");
if(userName.length()<6||userName.length()>20)
{
msgStr="对不起,用户名必须为字母、数字或下划线,长度为6-20个字符!";
}
else
{
boolean bTmp=this.IsContain(userName); //找查数据库中有无该用户名
if(bTmp)
msgStr="对不起,此用户名已经存在,请更换用户名注册!";
else
msgStr="该用户名有效,可以使用!";
}
response.getWriter().write(msgStr);
}
}//try
catch(Exception ex){}
}//doget
//处理Post请求函数
protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException
{
doGet(request,response);
}
//Servlet初始函数
public void init(ServletConfig config) throws ServletException
{
//初始已注册用户名字列表
usernameList=new String []{"Tomny","yangshuiqing","huoguangcheng"};
}
//判断用户名是否已经存在
private boolean IsContain(String param)
{
for (int i=0;i<usernameList.length ;i++ )
{
if(usernameList[i].equals(param))
{
return true;
}
else
continue;
}
return false;
}
} //End of Class
没有合适的资源?快使用搜索试试~ 我知道了~
JavaScript动态网页开发详解(全部源代码)
共294个文件
html:228个
jpg:16个
db:15个
5星 · 超过95%的资源 需积分: 50 185 下载量 147 浏览量
2008-10-29
16:55:46
上传
评论 6
收藏 3.65MB RAR 举报
温馨提示
JavaScript动态网页开发详解(全部源代码)全部21章希望对大家能够有用
资源推荐
资源详情
资源评论
收起资源包目录
JavaScript动态网页开发详解(全部源代码) (294个子文件)
submitconsolve.asp 911B
clock3d.class 11KB
color.css 113B
Thumbs.db 17KB
Thumbs.db 6KB
Thumbs.db 6KB
Thumbs.db 6KB
Thumbs.db 6KB
Thumbs.db 6KB
Thumbs.db 6KB
Thumbs.db 5KB
Thumbs.db 5KB
Thumbs.db 5KB
Thumbs.db 5KB
Thumbs.db 5KB
Thumbs.db 5KB
Thumbs.db 5KB
Thumbs.db 5KB
planets.gif 10KB
test.html 10KB
leftmain.html 8KB
test.html 6KB
test.html 5KB
test.html 5KB
test.html 5KB
leftmain.html 5KB
test.html 5KB
test.html 4KB
leftmain.html 4KB
leftmain.html 4KB
test.html 4KB
test.html 4KB
leftmain.html 4KB
test.html 4KB
test.html 4KB
test.html 4KB
test.html 4KB
test.html 4KB
test.html 4KB
test.html 3KB
main.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
target.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 3KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
flash_to_javascript.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
17-1.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
test.html 2KB
共 294 条
- 1
- 2
- 3
ygj281583295
- 粉丝: 19
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页