资源简介
简单javaweb登陆注册界面,适合初学者学习
代码片段和文件信息
package com.northwind.actions;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class UserAction extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Constructor of the object.
*/
public UserAction() {
super();
}
/**
* Destruction of the servlet.
*/
public void destroy() {
super.destroy(); // Just puts “destroy“ string in log
// Put your code here
}
/**
* The doGet method of the servlet.
*
* 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 {
doPost(request response);
}
/**
* The doPost method of the servlet.
*
* 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
*/
@SuppressWarnings(“unchecked“)
public void doPost(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
// 获取前台的内容
String method = request.getParameter(“method“);
String loginid = request.getParameter(“loginid“);
String password = request.getParameter(“password“);
@SuppressWarnings(“unused“)
String msg = ““; // 前台页面显示的内容
if (method == null) {
request.getRequestDispatcher(“/Pages/login.jsp“).forward(request
response);
} else if (“login“.equals(method)) {
if (loginid == ““) { // 如果用户名为空,直接返回错误信息
request.setAttribute(“msg“ “此用户不存在“);
request.getRequestDispatcher(“/Pages/login.jsp“).forward(
request response);
} else if (loginid.equals(“admin“)
&& password.equals(“admin“)) {
request.getRequestDispatcher(“/Pages/success.jsp“).forward(
request response);
} else {
request.setAttribute(“msg“ “用户名或密码错误“);
request.getRequestDispatcher(“/Pages/login.jsp“).forward(
request response);
}
}
}
/**
* Initialization of the servlet.
*
* @throws ServletException
* if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-05-25 10:38 ServerletWeb
文件 362 2012-05-25 10:38 ServerletWeb\.classpath
目录 0 2012-05-25 10:38 ServerletWeb\.myeclipse
文件 309 2012-05-25 10:38 ServerletWeb\.myme
文件 1418 2012-05-25 11:04 ServerletWeb\.project
目录 0 2012-05-25 10:38 ServerletWeb\.settings
文件 406 2012-05-25 10:38 ServerletWeb\.settings\.jsdtscope
文件 49 2012-05-25 10:38 ServerletWeb\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2012-05-25 10:38 ServerletWeb\.settings\org.eclipse.wst.jsdt.ui.superType.name
目录 0 2012-05-25 10:39 ServerletWeb\src
目录 0 2012-05-25 10:39 ServerletWeb\src\com
目录 0 2012-05-25 10:39 ServerletWeb\src\com\northwind
目录 0 2012-05-25 10:39 ServerletWeb\src\com\northwind\actions
文件 2969 2012-05-25 10:52 ServerletWeb\src\com\northwind\actions\UserAction.java
目录 0 2012-05-25 10:52 ServerletWeb\WebRoot
目录 0 2012-05-25 10:38 ServerletWeb\WebRoot\me
文件 39 2012-05-25 10:38 ServerletWeb\WebRoot\me
目录 0 2012-05-25 10:52 ServerletWeb\WebRoot\Pages
文件 924 2012-05-25 08:29 ServerletWeb\WebRoot\Pages\login.jsp
文件 228 2012-05-25 08:29 ServerletWeb\WebRoot\Pages\success.jsp
目录 0 2012-05-25 10:38 ServerletWeb\WebRoot\WEB-INF
目录 0 2012-05-25 10:39 ServerletWeb\WebRoot\WEB-INF\classes
目录 0 2012-05-25 10:39 ServerletWeb\WebRoot\WEB-INF\classes\com
目录 0 2012-05-25 10:39 ServerletWeb\WebRoot\WEB-INF\classes\com\northwind
目录 0 2012-05-25 10:39 ServerletWeb\WebRoot\WEB-INF\classes\com\northwind\actions
文件 1965 2012-05-25 10:52 ServerletWeb\WebRoot\WEB-INF\classes\com\northwind\actions\UserAction.class
目录 0 2012-05-25 10:38 ServerletWeb\WebRoot\WEB-INF\lib
文件 701 2012-05-25 11:04 ServerletWeb\WebRoot\WEB-INF\web.xm
----------- --------- ---------- ----- ----
9376 28
............此处省略1个文件信息
- 上一篇:java web房屋出租系统项目
- 下一篇:Java实现的简单JPEG编码程序
相关资源
- JavaWeb停车场管理系统(源代码,数据
- 基于JAVAweb的教务排课系统
- 锐聘学院QST青软JavaWeb十二个打包
- javaweb网上购物系统源码(附数据库脚
- javaweb校园宿舍系统(附数据库脚本)
- JavaWeb书城项目(附数据库脚本)
- 基于SSH框架的JavaWeb项目—人员信息管
- javaweb实现的邮件收发系统(附数据库
- java web知识点总结思维导图
- java web项目案例——知识管理软
- 博客系统笔记以及源码
- 李兴华JavaWeb培训经典笔记
- javaweb程序源码
- 基于JavaWeb的美食图片分享网站.zip
- JavaWeb-学生在线选课系统
- JavaWeb经典项目-图书管理系统
- 二手房屋交易系统
- 网络购物商城项目-12个项目
- 毕设:基于javaweb的宿舍管理系统
- javaweb政府oa代码
- 基于SSM框架的网上书店商城项目系统
- 旅游平台JAVA WEB
- JavaWeb网上图书商城完整项目资料
- JavaWeb开发的BBS系统
- SSM+Mysql实现防慕课网项目.zip
- Java Web开发实战经典
- 深入分析JavaWeb技术内幕修订版_13596
- JavaWEB商城项目(包括数据库)
- 基于JavaWeb的网上书店的设计与实现毕
- 基于JavaWeb学生管理系统
川公网安备 51152502000135号
评论
共有 条评论