资源简介
servlet/jsp编写的的购物车源码
代码片段和文件信息
package servlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class checklogin extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* 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 {
response.setContentType(“text/html;charset=gbk“);
PrintWriter out= response.getWriter();
HttpSession session=request.getSession();
String forward;
//判断用户是否已经登录
if(session.getAttribute(“username“)==null){
request.setAttribute(“info““您未登录,请先登录!“);
forward=“userlogin.jsp“;
}else{
forward=“cart.jsp“;
}
RequestDispatcher rd=request.getRequestDispatcher(forward);
rd.forward(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“);
PrintWriter out = response.getWriter();
out
.println(““);
out.println(““);
out.println(“ tle>A Servlet tle>“);
out.println(“ “);
out.print(“ This is “);
out.print(this.getClass());
out.println(“ using the POST method“);
out.println(“ “);
out.println(““);
out.flush();
out.close();
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2251776 2011-06-26 23:24 0820420101\2011Web系统开发与设计-期末课程设计报告.doc
文件 417 2011-06-22 19:10 0820420101\lk\.classpath
文件 840 2011-06-24 15:27 0820420101\lk\.myeclipse\profiler\lk on MyEclipse Tomcat.xm
文件 281 2011-06-24 14:50 0820420101\lk\.myme
文件 1412 2011-06-22 17:36 0820420101\lk\.project
文件 500 2011-06-22 17:36 0820420101\lk\.settings\.jsdtscope
文件 334 2011-06-22 17:36 0820420101\lk\.settings\org.eclipse.jdt.core.prefs
文件 49 2011-06-22 19:10 0820420101\lk\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2011-06-22 19:10 0820420101\lk\.settings\org.eclipse.wst.jsdt.ui.superType.name
文件 2404 2011-06-22 17:36 0820420101\lk\src\servlets\checklogin.java
文件 3112 2011-06-22 17:36 0820420101\lk\src\servlets\GetUserinfoServlet.java
文件 2263 2011-06-24 14:53 0820420101\lk\src\servlets\login.java
文件 1433 2011-06-22 17:36 0820420101\lk\src\servlets\logout.java
文件 3105 2011-06-22 17:36 0820420101\lk\src\servlets\modifyUser.java
文件 4121 2011-06-22 19:17 0820420101\lk\src\servlets\regservlet.java
文件 5140 2011-06-22 19:17 0820420101\lk\src\servlets\ShowUserServlet.java
文件 2417 2011-06-22 17:36 0820420101\lk\src\servlets\UserInfoManager.java
文件 3901 2011-06-22 17:36 0820420101\lk\src\shopservlets\addgoods.java
文件 3406 2011-06-22 17:36 0820420101\lk\src\shopservlets\addtocart.java
文件 5394 2011-06-22 17:36 0820420101\lk\src\shopservlets\buyservlet.java
文件 4749 2011-06-25 18:37 0820420101\lk\src\shopservlets\GetAllGoodsServlet.java
文件 4201 2011-06-22 21:26 0820420101\lk\src\shopservlets\modifygoods.java
文件 3199 2011-06-22 17:36 0820420101\lk\src\shopservlets\PocessCartServlet.java
文件 4746 2011-06-22 19:17 0820420101\lk\src\shopservlets\showgoods.java
文件 2481 2011-06-22 17:36 0820420101\lk\src\shopservlets\showorder.java
文件 2457 2011-06-22 19:17 0820420101\lk\src\toolbean\DBBean.java
文件 4065 2011-06-22 17:36 0820420101\lk\src\toolbean\GoodsBean.java
文件 451 2011-06-22 17:36 0820420101\lk\src\toolbean\Mycartbean.java
文件 1638 2011-06-22 17:36 0820420101\lk\src\toolbean\Mycartlsbean.java
文件 1416 2011-06-22 17:36 0820420101\lk\src\toolbean\MyTools.java
............此处省略113个文件信息
评论
共有 条评论