资源简介
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的仓库管理系统105788
- StudentManagerWeb.zip
- JSP+MYSQL校园一卡通系统 源代码
- jsp+sqlserver库存管理系统精品毕业设计
- jsp中国移动计费系统
- jsp00357房屋中介管理系统ssh+myeclipse+
- JSP服装销售系统(毕业设计)
- JSP MYSQL SSH教师教学评价管理系统
- JSP房屋租售管理系统java+mysql+ssh.
- JSP机票网上销售系统
- JSP+MYSQL飞机订票系统-毕业设计
- JSP学生选课系统完整版
- webshell -真实可用的jsp 马
- Jfinal框架搭建JSP项目Demo
- 双鱼林JSP基于SSH2教务选课成绩管理系
- JSP在线教学平台
- jsp网站开发与第3版
- JSP人事管理系统(毕业设计)
- jsp程序设计课后习题答案227159
- jsp+sql的招聘兼职网站
- JSP学生兼职家教系统--毕业设计
- 二手房屋交易系统
- jsp地铁售票系统jsp地铁售票系统
- JSP银行模拟转账系统
- 基于JSP的餐馆点菜系统
- 旅游平台JAVA WEB
- Java大学报修系统源码 Servlet+hibernate
- Ajax分页-增删改查-Oracle数据库-默认
- JSP项目技术源代码(15个项目)
- jsp+servlet+mysql企业人事管理系统16438
评论
共有 条评论