package servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class CheckServlet extends HttpServlet {
/**
* Constructor of the object.
*/
public CheckServlet() {
super();
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
response.setCharacterEncoding("UTF-8");
response.setContentType("text/xml;charset=UTF-8");
response.setHeader("Cache-Control", "no-cache");
String username = (String)request.getParameter("username");
System.out.println("username:"+username);
LoginClass lc = new LoginClass();
if(username.equals("") || username == null){
out.println("<response><message>Null</message></response>");
}else if(lc.checkusername(username) == 0){
out.println("<response><message>Wrong</message></response>");
}else{
out.println("<response><message>OK</message></response>");
System.out.println("存在此用户");
}
out.close();
//response.getWriter().write(xml);
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
doGet(request,response);
out.close();
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
一个简单的ajax验证登录
共41个文件
jar:11个
tld:6个
class:5个
需积分: 15 45 下载量 113 浏览量
2008-09-12
16:48:33
上传
评论
收藏 1.95MB RAR 举报
温馨提示
本资源就仔细的介绍一个ajax的验证登陆,并附上了详细的代码供不会ajax的人学习..
资源推荐
资源详情
资源评论
收起资源包目录
first.rar (41个子文件)
first
.project 1KB
.mymetadata 285B
WebRoot
test.jsp 362B
WEB-INF
struts-tiles.tld 8KB
.struts-config.mex 2KB
web.xml 1KB
struts-config.xml 810B
struts-bean.tld 9KB
struts-nested.tld 63KB
struts-html.tld 65KB
struts-template.tld 2KB
struts-logic.tld 14KB
validator-rules.xml 41KB
lib
commons-logging.jar 27KB
commons-digester.jar 96KB
commons-fileupload.jar 19KB
commons-beanutils.jar 100KB
commons-lang.jar 53KB
struts.jar 428KB
commons-validator.jar 40KB
struts-legacy.jar 9KB
classes12.jar 1.14MB
jakarta-oro.jar 62KB
commons-collections.jar 160KB
classes
action
LoginAction.class 2KB
com
yourcompany
struts
ApplicationResources.properties 87B
servlet
LoginClass.class 1KB
CheckServlet.class 2KB
form
LoginForm.class 768B
connection
ConnectionDB.class 851B
index.jsp 2KB
META-INF
MANIFEST.MF 39B
check.jsp 536B
.myeclipse
src
action
LoginAction.java 1KB
com
yourcompany
struts
ApplicationResources.properties 87B
servlet
LoginClass.java 695B
CheckServlet.java 3KB
form
LoginForm.java 938B
connection
ConnectionDB.java 461B
.mystrutsdata 262B
.classpath 1KB
共 41 条
- 1
资源评论
zngao190388908
- 粉丝: 4
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功