资源简介
jsp+servlet+EJB简单应用开发,实现用户登录和注册

代码片段和文件信息
package servlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import student.service.StudentService;
public class DoLogin extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Constructor of the object.
*/
public DoLogin() {
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(requestresponse);
}
/**
* 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
*/
public void doPost(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
response.setContentType(“text/html;charset=GB2312“);
PrintWriter out=response.getWriter();
String id=request.getParameter(“Number“).trim();
InitialContext ctx = null;
try {
ctx = new InitialContext();
} catch (NamingException e1) {
e1.printStackTrace();
}
StudentService studentService = null;
try {
studentService = (StudentService) ctx.lookup(“StudentServiceBean/remote“);
} catch (NamingException e) {
e.printStackTrace();
}
String message = studentService.login(id);
out.print(“ript language=javascript>alert(‘“+message+“‘);window.open(‘/EntityBeanJspServlet/login.jsp‘‘_parent‘); ript>“);
out.flush();
out.close();
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 523 2009-06-26 17:18 jsp+servlet+ejb\EntityBeanJspServlet\.classpath
文件 333 2009-06-26 10:13 jsp+servlet+ejb\EntityBeanJspServlet\.myme
文件 1238 2009-06-26 16:06 jsp+servlet+ejb\EntityBeanJspServlet\.project
文件 118 2009-06-24 13:41 jsp+servlet+ejb\EntityBeanJspServlet\src\jndi.properties
文件 2526 2009-06-27 12:21 jsp+servlet+ejb\EntityBeanJspServlet\src\servlets\DoLogin.java
文件 3866 2009-06-26 23:46 jsp+servlet+ejb\EntityBeanJspServlet\src\servlets\DoRegister.java
文件 2691 2009-06-26 20:52 jsp+servlet+ejb\EntityBeanJspServlet\src\servlets\my.java
文件 272967 2008-09-22 15:49 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\0001_0002_0004.jpg
文件 262659 2008-09-22 15:49 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\0001_0002_0005.jpg
文件 179059 2008-09-22 15:49 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\0001_0002_0015.jpg
文件 212864 2008-09-22 15:49 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\0001_0002_0017.jpg
文件 129893 2008-09-22 15:50 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\0002_0000_0004.jpg
文件 129426 2008-09-22 15:50 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\0002_0000_0011.jpg
文件 104061 2008-09-22 15:51 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\0002_0000_0016.jpg
文件 262541 2008-09-22 15:51 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\0002_0000_0023.jpg
文件 165357 2008-09-22 15:50 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\0002_0000_0028.jpg
文件 184749 2008-10-06 15:36 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\0002_0000_0033.jpg
文件 205339 2008-09-22 15:52 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\0004_0000_0002.jpg
文件 194158 2008-09-22 15:52 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\0004_0000_0004.jpg
文件 201918 2008-09-22 15:52 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\0004_0000_0005.jpg
文件 423 2005-09-11 13:09 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\cold.htc
文件 2088 2009-06-26 16:28 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\index.jsp
文件 2104 2009-06-27 12:15 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\login.jsp
文件 40760 2008-09-22 14:40 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\logo.jpg
文件 39 2009-06-26 10:13 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\me
文件 2965 2009-06-26 23:16 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\register.jsp
文件 118 2009-06-24 13:41 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\WEB-INF\classes\jndi.properties
文件 2213 2009-06-27 12:21 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\WEB-INF\classes\servlets\DoLogin.class
文件 3284 2009-06-26 23:46 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\WEB-INF\classes\servlets\DoRegister.class
文件 1801 2009-06-26 20:52 jsp+servlet+ejb\EntityBeanJspServlet\WebRoot\WEB-INF\classes\servlets\my.class
............此处省略43个文件信息
- 上一篇:基于Java贪吃蛇游戏毕业论文
- 下一篇:Android实验报告--扫雷游戏
相关资源
- JSP企业人事管理系统设计(源代码+论
- 实现一个图书管理系统
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- JSP,SQL,MVC的选课系统
- 基于JSP的学生宿舍管理系统(源码 数
- JSP选课管理系统
- mysql jsp网站源码下载
- JSP做的化妆品商城
- Jsp购物车实例
- 基于JSP的校友信息管理系统(添加数
- 基于jsp的bbs论坛 非常详细
- java Servlet投票实例
- jsp oracle通讯录
- JSP学生信息管理系统 Mysql数据库
- 使用jsp servlet做的投票系统
- JSP登陆验证 实现JSP用户名 密码 验
- jsp基于servlet 图书馆管理系统
- jsp学生成绩管理系统.rar
- 在线考试系统源代码(jsp)
- 超级好的纯jsp写的聊天室
- JSP 网上购物网页项目
- JSP+mysql新闻发布系统.rar
- jsp 学生信息管理系统设计与实现
- jsp与SQL Server数据库实现的客户注册登
- 简易教学管理系统(jsp spring struts h
- 学生信息管理系统 JSP MySQL
- jsp ajax 三级联动菜单
- jsp新闻公告与最新消息系统(具备添
- JSP课程设计-留言本 jsp mysql tomcat实现
评论
共有 条评论