- 浏览: 48728 次
- 性别:
- 来自: 合肥
文章分类
最新评论
首先是登陆界面,其中有mes_zh等国际化 这个不重要
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<style>
body{
fontsize:12px;
}
#keyword,#iskey{
color:red;
}
</style>
<html>
<head>
</head>
<body>
<%-- ${cookie}--%>
<fmt:setBundle basename="mes"/>
<span style="color:red;fontSize:15px">${LogFail}</span>
<form action="login.do" method="post">
<fmt:message key="username"></fmt:message><input type="text" name="username"/>
<fmt:message key="password"></fmt:message></fmt><input type="password" name="password"/>
<input style="margin-left: 50px"type="checkbox" name="remeber" value="yes"/>
<span style="color:red">是否记住密码?</span><br/>
<input style="margin-top:20px" type="submit" value="<fmt:message key="login"></fmt:message>"/>
</form>
<table>
<tr><th colspan="6"><fmt:message key="key"></fmt:message><span id="keyword">${keyWord}</span></th></tr>
<tr><th><fmt:message key="id"></fmt:message></th><th><fmt:message key="name"></fmt:message></th>
<th><fmt:message key="address"></fmt:message></th><th><fmt:message key="phone"></fmt:message></th>
<th><fmt:message key="email"></fmt:message></th><th><fmt:message key="sex"></fmt:message></th></tr>
<c:forEach items="${contacts}" var="con">
<tr><td>${con.id}</td><td id="iskey">${con.name}</td><td>${con.address}</td><td>${con.phone }</td><td>${con.email}</td><td>${con.sex }</th></tr>
</c:forEach>
</table>
</body>
</html>
接下来是上面post请求的servlet类
package com.ourchr.addressbook.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import bo.UserBO;
import entity.User;
public class LoginServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Cookie[] cookies = request.getCookies();
Cookie cookie = null;
String username = null;
String password = null;
if (cookies != null) {
for (int i = 0; i < cookies.length; i++) {
cookie = cookies[i];
System.out.println(cookie.getName()+"++++"+cookie.getValue());
if (cookie.getName().equals("username")){
username = cookie.getValue();
}
if(cookie.getName().equals("password")){
password = cookie.getValue();
}
}
}
UserBO userBO =new UserBO();
User user = userBO.login(username, password);
if(user==null){
request.getRequestDispatcher("/login.jsp").forward(request, response);
}else{
request.getSession().setAttribute("user", user);
String url = (String) request.getAttribute("requestURL");
response.sendRedirect(url);
return;
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html");
String username = request.getParameter("username");
String password = request.getParameter("password");
String remeber = request.getParameter("remeber");
System.out.println(username+"==="+password+"==="+remeber);
UserBO userBO = new UserBO();
User user = userBO.login(username, password);
if (user == null) {
request.setAttribute("LogFail", "用户名或密码错误,请重新登录");
request.getRequestDispatcher("/login.jsp").forward(request,
response);
} else {
request.getSession().setAttribute("user", user);
if (remeber.equals("yes")) {
Cookie cookie = new Cookie("username", username);
cookie.setMaxAge(3600 * 24 * 30);
response.addCookie(cookie);
cookie= new Cookie("password", password);
cookie.setMaxAge(3600 * 24 * 30);
response.addCookie(cookie);
request.getSession().setAttribute("user", user);
System.out.println(request.getCookies().length+"------");
}
request.getRequestDispatcher("/choseItem.jsp").forward(request,
response);
}
}
}
剩下的都是容易实现的了
我把该登陆用户的功能分为两部分
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="h" tagdir="/WEB-INF/tags" %>
<style>
body{
fontsize;12px;
}
#link{
width:100px;
height:50px;
}
</style>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<h:ckeckLogin></h:ckeckLogin>
<div style="color:blue;fontsize;15px;margin-bottom:50px">${LogSuccess}</div>
<div id="link">
<a href="addContact.jsp" id="addLink">增加联系人</a>
</div>
<div id="link">
<a href="findContact.jsp" id="findLink">查找联系人</a>
</div>
</body>
</html>
那接下来增加和查找也顺便写下吧
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'checkLogin.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<hr/>
添加失败的用户信息: <c:out value="${Conexception}"></c:out>
<hr/>
<form action="doAddContact.jsp" method="post">
<table>
<tr>
<td>姓名:</td><td><input type="text" name="username"/></td>
</tr>
<tr>
<td>手机:</td><td><input type="text" name="phone"/></td>
</tr>
<tr>
<td>Email:</td><td><input type="text" name="email"/></td>
</tr>
<tr>
<td>地址:</td><td><input type="text" name="address"/></td>
</tr>
<tr>
<td>性别:</td>
<td>
男<input type="radio" name="sex" value="male" ckecked="checked" >
女<input type="radio" name="sex" value="female" >
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="提交"/><input type="reset" value="重置"/>
</td>
</tr>
</table>
</form>
</body>
</html>
<%@ page language="java" import="java.util.*,com.ourchr.assdressbook.entity.*,entity.*,com.ourchr.addressbook.bo.*,com.ourchr.addressbook.exception.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'doAddContact.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String name =request.getParameter("username");
String phone =request.getParameter("phone");
String email = request.getParameter("email");
String address = request.getParameter("address");
String sex = request.getParameter("sex");
Contact contact = new Contact();
contact.setName(name);
contact.setPhone(phone);
contact.setEmail(email);
contact.setAddress(address);
contact.setSex(sex);
contact.setOwner((User)session.getAttribute("user"));
session.setAttribute("contact",contact);
ContactBO contactBO = new ContactBO();
%>
<c:catch var="ContactExistException">
<%
contactBO.addContact(contact);
%>
</c:catch>
<c:if test="${not empty ContactExistException}">
<c:set var="Conexception" value="${ContactExistException.message}" scope="request"></c:set>
<jsp:forward page="/addContact.jsp"></jsp:forward>
</c:if>
<c:if test="${empty ContactExistException}">
<jsp:forward page="/showContact.jsp"></jsp:forward>
</c:if>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<h1>给用户提供查询联系人:</h1>
<form action="doFindContact.jsp" method="post">
<input type="text" name="conName"/>
<input type="submit">
</form>
</body>
</html>
<%@ page language="java" import="java.util.*,entity.*,com.ourchr.assdressbook.entity.*,com.ourchr.addressbook.bo.ContactBO" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String conNameIndex =request.getParameter("conName");
User owner= (User)session.getAttribute("user");
ContactBO contactBO = new ContactBO();
List<Contact> contacts=contactBO.findContacts(owner,conNameIndex);
request.setAttribute("keyWord",conNameIndex);
request.setAttribute("contacts",contacts);
%>
<jsp:forward page="login.jsp"></jsp:forward>
</body>
</html>
那几本上都差不多了吧
还有一个标签
<%@ tag pageEncoding="utf-8" body-content="scriptless" import="entity.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
User user = (User)session.getAttribute("user");
if(user == null){
String url = request.getRequestURL().toString();
request.setAttribute("requestURL",url);
request.getRequestDispatcher("login.do").forward(request,response);
}
%>
完成!
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<style>
body{
fontsize:12px;
}
#keyword,#iskey{
color:red;
}
</style>
<html>
<head>
</head>
<body>
<%-- ${cookie}--%>
<fmt:setBundle basename="mes"/>
<span style="color:red;fontSize:15px">${LogFail}</span>
<form action="login.do" method="post">
<fmt:message key="username"></fmt:message><input type="text" name="username"/>
<fmt:message key="password"></fmt:message></fmt><input type="password" name="password"/>
<input style="margin-left: 50px"type="checkbox" name="remeber" value="yes"/>
<span style="color:red">是否记住密码?</span><br/>
<input style="margin-top:20px" type="submit" value="<fmt:message key="login"></fmt:message>"/>
</form>
<table>
<tr><th colspan="6"><fmt:message key="key"></fmt:message><span id="keyword">${keyWord}</span></th></tr>
<tr><th><fmt:message key="id"></fmt:message></th><th><fmt:message key="name"></fmt:message></th>
<th><fmt:message key="address"></fmt:message></th><th><fmt:message key="phone"></fmt:message></th>
<th><fmt:message key="email"></fmt:message></th><th><fmt:message key="sex"></fmt:message></th></tr>
<c:forEach items="${contacts}" var="con">
<tr><td>${con.id}</td><td id="iskey">${con.name}</td><td>${con.address}</td><td>${con.phone }</td><td>${con.email}</td><td>${con.sex }</th></tr>
</c:forEach>
</table>
</body>
</html>
接下来是上面post请求的servlet类
package com.ourchr.addressbook.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import bo.UserBO;
import entity.User;
public class LoginServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Cookie[] cookies = request.getCookies();
Cookie cookie = null;
String username = null;
String password = null;
if (cookies != null) {
for (int i = 0; i < cookies.length; i++) {
cookie = cookies[i];
System.out.println(cookie.getName()+"++++"+cookie.getValue());
if (cookie.getName().equals("username")){
username = cookie.getValue();
}
if(cookie.getName().equals("password")){
password = cookie.getValue();
}
}
}
UserBO userBO =new UserBO();
User user = userBO.login(username, password);
if(user==null){
request.getRequestDispatcher("/login.jsp").forward(request, response);
}else{
request.getSession().setAttribute("user", user);
String url = (String) request.getAttribute("requestURL");
response.sendRedirect(url);
return;
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html");
String username = request.getParameter("username");
String password = request.getParameter("password");
String remeber = request.getParameter("remeber");
System.out.println(username+"==="+password+"==="+remeber);
UserBO userBO = new UserBO();
User user = userBO.login(username, password);
if (user == null) {
request.setAttribute("LogFail", "用户名或密码错误,请重新登录");
request.getRequestDispatcher("/login.jsp").forward(request,
response);
} else {
request.getSession().setAttribute("user", user);
if (remeber.equals("yes")) {
Cookie cookie = new Cookie("username", username);
cookie.setMaxAge(3600 * 24 * 30);
response.addCookie(cookie);
cookie= new Cookie("password", password);
cookie.setMaxAge(3600 * 24 * 30);
response.addCookie(cookie);
request.getSession().setAttribute("user", user);
System.out.println(request.getCookies().length+"------");
}
request.getRequestDispatcher("/choseItem.jsp").forward(request,
response);
}
}
}
剩下的都是容易实现的了
我把该登陆用户的功能分为两部分
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="h" tagdir="/WEB-INF/tags" %>
<style>
body{
fontsize;12px;
}
#link{
width:100px;
height:50px;
}
</style>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<h:ckeckLogin></h:ckeckLogin>
<div style="color:blue;fontsize;15px;margin-bottom:50px">${LogSuccess}</div>
<div id="link">
<a href="addContact.jsp" id="addLink">增加联系人</a>
</div>
<div id="link">
<a href="findContact.jsp" id="findLink">查找联系人</a>
</div>
</body>
</html>
那接下来增加和查找也顺便写下吧
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'checkLogin.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<hr/>
添加失败的用户信息: <c:out value="${Conexception}"></c:out>
<hr/>
<form action="doAddContact.jsp" method="post">
<table>
<tr>
<td>姓名:</td><td><input type="text" name="username"/></td>
</tr>
<tr>
<td>手机:</td><td><input type="text" name="phone"/></td>
</tr>
<tr>
<td>Email:</td><td><input type="text" name="email"/></td>
</tr>
<tr>
<td>地址:</td><td><input type="text" name="address"/></td>
</tr>
<tr>
<td>性别:</td>
<td>
男<input type="radio" name="sex" value="male" ckecked="checked" >
女<input type="radio" name="sex" value="female" >
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="提交"/><input type="reset" value="重置"/>
</td>
</tr>
</table>
</form>
</body>
</html>
<%@ page language="java" import="java.util.*,com.ourchr.assdressbook.entity.*,entity.*,com.ourchr.addressbook.bo.*,com.ourchr.addressbook.exception.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'doAddContact.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String name =request.getParameter("username");
String phone =request.getParameter("phone");
String email = request.getParameter("email");
String address = request.getParameter("address");
String sex = request.getParameter("sex");
Contact contact = new Contact();
contact.setName(name);
contact.setPhone(phone);
contact.setEmail(email);
contact.setAddress(address);
contact.setSex(sex);
contact.setOwner((User)session.getAttribute("user"));
session.setAttribute("contact",contact);
ContactBO contactBO = new ContactBO();
%>
<c:catch var="ContactExistException">
<%
contactBO.addContact(contact);
%>
</c:catch>
<c:if test="${not empty ContactExistException}">
<c:set var="Conexception" value="${ContactExistException.message}" scope="request"></c:set>
<jsp:forward page="/addContact.jsp"></jsp:forward>
</c:if>
<c:if test="${empty ContactExistException}">
<jsp:forward page="/showContact.jsp"></jsp:forward>
</c:if>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<h1>给用户提供查询联系人:</h1>
<form action="doFindContact.jsp" method="post">
<input type="text" name="conName"/>
<input type="submit">
</form>
</body>
</html>
<%@ page language="java" import="java.util.*,entity.*,com.ourchr.assdressbook.entity.*,com.ourchr.addressbook.bo.ContactBO" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String conNameIndex =request.getParameter("conName");
User owner= (User)session.getAttribute("user");
ContactBO contactBO = new ContactBO();
List<Contact> contacts=contactBO.findContacts(owner,conNameIndex);
request.setAttribute("keyWord",conNameIndex);
request.setAttribute("contacts",contacts);
%>
<jsp:forward page="login.jsp"></jsp:forward>
</body>
</html>
那几本上都差不多了吧
还有一个标签
<%@ tag pageEncoding="utf-8" body-content="scriptless" import="entity.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
User user = (User)session.getAttribute("user");
if(user == null){
String url = request.getRequestURL().toString();
request.setAttribute("requestURL",url);
request.getRequestDispatcher("login.do").forward(request,response);
}
%>
完成!
发表评论
-
oracle 笔记下
2011-07-06 18:17 746建立表空间:建立表空 ... -
oracle 学习笔记上
2011-06-20 19:00 10311.oracle 安装完成后,会 ... -
jquery 对select中的option操作
2011-06-15 16:28 6214Jquery的功能很强大,下面 ... -
MySQL实现分页技术
2011-06-09 08:29 875先给出servlet package com.ourchr.s ... -
java学习日记(线程)
2011-05-18 18:38 773java学习日记(线程) 一 ... -
Java Servlet和JSP 处理Cookie
2011-05-18 13:28 19149.1 Cookie概述 Cookie是服务器发送给浏 ... -
简单的qq实现
2011-05-17 18:42 676很好用 简洁 -
简单的日历控件
2011-05-17 18:40 750package Exception; import java ... -
完整的JDBC 简单列子
2011-05-17 18:38 648package dao; import java.sql.Co ... -
jsp jstl 标签3
2011-05-13 17:38 674<c:import> 作用:导入一个url的资源, ... -
jsp jstl 标签2
2011-05-13 17:38 714c:forEach 用于循环的<c:forEach&g ... -
jsp jstl 标签1
2011-05-13 17:36 1159一、引入包: jstl.jar (1 ... -
js 中this用发小结
2011-03-09 09:19 668js中this的总结 在面向对 ... -
js 正则表达式
2011-02-24 15:12 603js正则表达式 exec 方法 用正则表达式模式在字符串中运 ... -
WEB innerHTML中div 和span
2011-02-24 13:58 1203使用innerHTML属性来控制DIV和SPAN<$lo ... -
Myeclipse 快捷键打总结
2011-01-08 13:01 690xml、jsp、jsf、js等等,我们没有必要全部都去自动校验 ... -
java基础知识
2011-01-07 17:35 630 -
java文件夹之间的复制
2011-01-06 14:58 628package Exception; import java. ...
相关推荐
用servlet jsp实现简单购物车 jsp显示页面 使用了jstl
HTTP请求报头 5、服务器响应的生成:HTTP状态代码 6、服务器响应的生成: HTTP响应报头 7、cookie管理 8、会话跟踪 9、JSP技术概述 10、JDBC 11、控制所生成的servlet 的结构:JSP page指令...
HTTP请求报头 5、服务器响应的生成:HTTP状态代码 6、服务器响应的生成: HTTP响应报头 7、cookie管理 8、会话跟踪 9、JSP技术概述 10、JDBC 11、控制所生成的servlet 的结构:JSP page指令...
本书共分4部分,从xml、servlet、jsp和应用的角度向读者展示了java web开发中各种技术的应用,循序渐进地引导读者快速掌握java web开发。. 本书内容全面,涵盖了从事java web开发所应掌握的所有知识。在知识的讲解...
项目名称:Cookie版人员管理系统。 使用技术:servlet+jsp+mysql+Cookie技术
本书共分4部分,从xml、servlet、jsp和应用的角度向读者展示了java web开发中各种技术的应用,循序渐进地引导读者快速掌握java web开发。. 本书内容全面,涵盖了从事java web开发所应掌握的所有知识。在知识的讲解...
第1章 servlet和jsp技术概述 1.1 servlet的功用 1.2 要动态构建网页的原因 1.3 servlet代码初探 1.4 servlet相对于“传统”cgi的优点 1.5 jsp的作用 第1部分 servlet技术 第2章 服务器的安装和配置 ...
cookie servlet jsp 登录 记录登陆次数
HTTP请求报头 5、服务器响应的生成:HTTP状态代码 6、服务器响应的生成: HTTP响应报头 7、cookie管理 8、会话跟踪 9、JSP技术概述 10、JDBC 11、控制所生成的servlet 的结构:JSP page指令...
本书共分4部分,从xml、servlet、jsp和应用的角度向读者展示了java web开发中各种技术的应用,循序渐进地引导读者快速掌握java web开发。. 本书内容全面,涵盖了从事java web开发所应掌握的所有知识。在知识的讲解...
使用jsp+Servlet+cookie实现一个登录功能,登录时可以选中记住密码。
创建web工程还有代码是试练,请求方式+重定向+请求转发+cookie+session+jsp(四大作用域九大内置对象)
J2EE servlet&jsp 练习二答案 学习使用Session和Cookie 开发一个简单的购物车; 开发一个简单的用户登录提示系统 设定Session生命周期; 开发一个下载文件的Java EE Web应用; 开发一个Session监听器
先來看看如何撰寫基本的JSP動態網頁,以及JSP背後運作的機制,JSP事實上也是轉譯為 Servlet,骨子裡還是個Servlet程式。 第一個JSP程式 註解與Quoting Scripting Elements page Directive Element include ...
本文对servlet和jsp中的session作了详细的介绍,包括cookie对于开发wed服务程序很有帮助,是对http无状态协议的深入理解
本书共分4部分,从xml、servlet、jsp和应用的角度向读者展示了java web开发中各种技术的应用,循序渐进地引导读者快速掌握java web开发。. 本书内容全面,涵盖了从事java web开发所应掌握的所有知识。在知识的讲解...
JSP & Servlet 技术总结 JSP技术总结 2 1. JSP页面元素构成 2 2. JSP脚本元素 2 3. 注释 2 4. JSP指令 2 5. JSP动作元素 3 6. JSP内置对象 5 7. JSP内置对象及其作用 5 8. 获取页面参数 5 9. 重定向...
Jsp+Servlet+Cookie实现记住密码,自动登录,防止表单提交,记录登录次数的新手例子。简单明了,大量注释,El表达式等。
javax.servlet.http.Cookie.class javax.servlet.http.HttpSessionAttributeListener.class javax.servlet.http.HttpServlet.class javax.servlet.http.HttpServletRequest.class javax.servlet....
答:JSP是Servlet技术的扩展,本质上是Servlet的简易方式,更强调应用的外表表达。JSP编译后是类servlet。Servlet和JSP最主要的不同点在于,Servlet的应用逻辑是在Java文件中,并且完全从表示层中的HTML里分离开来...