• 大小: 1.72MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-18
  • 语言: Java
  • 标签: javaweb  

资源简介

javaweb项目,可以再myeclipse上运行,该系统需要使用myelipse和mysql

资源截图

代码片段和文件信息

package com.shop.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.catalina.connector.Request;

import com.shopping.DBDao;

public class adminServlet extends HttpServlet {


public void doGet(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {

response.setContentType(“text/html;cahrset=utf-8“);
PrintWriter out = response.getWriter();
HttpSession session = request.getSession();
String sql = “update user set pwd = ‘“+request.getParameter(“pwd“)+“‘ tel = ‘“+request.getParameter(“tel“)+“‘ where“
+“ uname = ‘“+session.getAttribute(“name“)+“‘“;
DBDao dao = new DBDao();
if(dao.excuteBySQL(sql) > 0)
{
out.println(“ript>alert(‘修改成功!‘);location.href=‘../msp/LogIn.jsp‘;ript>“);
}
else
out.println(“ript>alert(‘修改失败!‘);location.href=‘../msp/LoginServlet‘;ript>“);


}

public void doPost(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
//request.setCharacterEncoding(“utf-8“);
//response.setCharacterEncoding(“utf-8“);
response.setContentType(“text/html“);
PrintWriter out = response.getWriter();
String st = request.getParameter(“aname“);
String pwd = request.getParameter(“pwd“);
Date date = new Date(0);
String sql = “select * from admin;“;
DBDao db = new DBDao();
ResultSet set = db.queryBySQL(sql);
try {
while(set.next())
{
if(set.getString(“ID“).equals(st) && set.getString(“pwd“).equals(pwd)) 
out.println(“ript>alert(‘登入成功!‘);location.href=‘../msp/ThingDelete.jsp‘;ript>“);
}
out.println(“ript>alert(‘登入失败!‘);location.href=‘../msp/LogIns.jsp‘;ript>“);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1293  2018-01-10 15:01  shopping\.classpath

     文件       1333  2018-01-10 08:36  shopping\.project

     文件        522  2018-01-10 08:27  shopping\.settings\.jsdtscope

     文件        364  2018-01-10 08:27  shopping\.settings\org.eclipse.jdt.core.prefs

     文件        475  2018-01-10 08:27  shopping\.settings\org.eclipse.wst.common.component

     文件        401  2018-01-10 08:27  shopping\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2018-01-10 08:27  shopping\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2018-01-10 08:27  shopping\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       3150  2018-01-16 11:08  shopping\build\classes\com\shop\servlet\adminServlet.class

     文件       2752  2018-01-15 17:53  shopping\build\classes\com\shop\servlet\LoginServlet.class

     文件       3177  2018-01-15 15:17  shopping\build\classes\com\shop\servlet\ThingsServlet.class

     文件       4781  2018-01-16 11:33  shopping\build\classes\com\shop\servlet\UserServlet.class

     文件       4812  2018-01-15 15:17  shopping\build\classes\com\shop\servlet\UserThingServlet.class

     文件       3408  2018-01-16 10:16  shopping\build\classes\com\shop\servlet\userThingsServlet.class

     文件       2085  2018-01-15 15:17  shopping\build\classes\com\shopping\DBDao.class

     文件       1223  2018-01-15 15:17  shopping\build\classes\com\shopping\FilterChar.class

     文件       2207  2018-07-02 08:28  shopping\src\com\shop\servlet\adminServlet.java

     文件       2123  2018-01-15 17:53  shopping\src\com\shop\servlet\LoginServlet.java

     文件       2288  2018-01-15 14:11  shopping\src\com\shop\servlet\ThingsServlet.java

     文件       4171  2018-01-16 11:33  shopping\src\com\shop\servlet\UserServlet.java

     文件       3734  2018-01-15 14:31  shopping\src\com\shop\servlet\UserThingServlet.java

     文件       2065  2018-01-16 10:16  shopping\src\com\shop\servlet\userThingsServlet.java

     文件       1466  2018-01-10 15:05  shopping\src\com\shopping\DBDao.java

     文件        815  2018-01-12 10:08  shopping\src\com\shopping\FilterChar.java

     文件        653  2018-07-02 08:25  shopping\WebRoot\index.jsp

     文件      55473  2018-01-15 15:10  shopping\WebRoot\logo.jpg

     文件       1145  2018-01-10 19:57  shopping\WebRoot\manage.jsp

     文件         39  2018-01-10 08:27  shopping\WebRoot\meta-INF\MANIFEST.MF

     文件       8456  2018-01-11 08:40  shopping\WebRoot\msp\blog-new.html

     文件       8726  2018-01-11 08:40  shopping\WebRoot\msp\blog-table.html

............此处省略145个文件信息

评论

共有 条评论