• 大小: 17.87MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-05
  • 语言: Java
  • 标签: jsp  java  web  

资源简介

框架:jsp,数据库:mysql,服务器: Tomcat,是用maven组织的,下载即可使用。有文档,有截图,有源码,还有数据库文件。

资源截图

代码片段和文件信息

package com.controll;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;

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

import com.database.Database;

public class Login extends HttpServlet {

/**
 * Constructor of the object.
 */
public Login() {
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 {
this.doPost(request response);
}

/**
 * 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 {
request.setCharacterEncoding(“UTF-8“);
String username = request.getParameter(“username“);
String password = request.getParameter(“password“);
String sql = “select * from user where username=‘“+username+“‘ and password=‘“+password+“‘“;
Database db = new Database();
Listject> list = db.doSelect(sql);
if(list.size()>0){
request.setAttribute(“username“((HashMap)list.get(0)).get(“username“));
request.setAttribute(“rolename“((HashMap)list.get(0)).get(“rolename“));
request.setAttribute(“name“((HashMap)list.get(0)).get(“name“));
request.setAttribute(“id“((HashMap)list.get(0)).get(“id“));
request.getRequestDispatcher(“/index.jsp“).forward(request response);
}else{
request.setAttribute(“message““提示:登录失败,请重试!“);
request.getRequestDispatcher(“/login.jsp“).forward(request response);
}
}

/**
 * Initialization of the servlet. 

 *
 * @throws ServletException if an error occurs
 */
public void init() throws ServletException {
// Put your code here
}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-04-13 10:57  trainDemo\
     文件       14667  2019-04-13 09:54  trainDemo\hcmanage.sql
     目录           0  2019-04-13 10:57  trainDemo\train\
     目录           0  2019-04-13 10:57  trainDemo\train\.idea\
     目录           0  2019-04-13 10:57  trainDemo\train\.idea\artifacts\
     文件         281  2019-03-31 14:14  trainDemo\train\.idea\artifacts\train_war.xml
     文件        1105  2019-03-31 15:22  trainDemo\train\.idea\artifacts\train_war_exploded.xml
     文件         622  2019-03-31 14:14  trainDemo\train\.idea\compiler.xml
     文件         172  2019-03-31 14:14  trainDemo\train\.idea\encodings.xml
     文件         232  2019-03-31 14:34  trainDemo\train\.idea\kotlinc.xml
     目录           0  2019-04-13 10:57  trainDemo\train\.idea\libraries\
     文件         775  2019-03-31 14:37  trainDemo\train\.idea\libraries\Java_EE_6_Java_EE_6.xml
     文件         574  2019-03-31 14:50  trainDemo\train\.idea\libraries\Maven__com_google_protobuf_protobuf_java_3_6_1.xml
     文件         473  2019-03-31 15:22  trainDemo\train\.idea\libraries\Maven__javax_servlet_jstl_1_2.xml
     文件         455  2019-03-31 14:14  trainDemo\train\.idea\libraries\Maven__junit_junit_4_11.xml
     文件         574  2019-03-31 14:50  trainDemo\train\.idea\libraries\Maven__mysql_mysql_connector_java_8_0_13.xml
     文件         626  2019-03-31 15:22  trainDemo\train\.idea\libraries\Maven__org_apache_taglibs_taglibs_standard_impl_1_2_5.xml
     文件         532  2019-03-31 14:14  trainDemo\train\.idea\libraries\Maven__org_hamcrest_hamcrest_core_1_3.xml
     文件         566  2019-03-31 14:14  trainDemo\train\.idea\misc.xml
     文件         250  2019-03-31 14:02  trainDemo\train\.idea\modules.xml
     文件       82864  2019-04-13 10:56  trainDemo\train\.idea\workspace.xml
     目录           0  2019-04-13 10:57  trainDemo\train\lib\
     文件        7713  2019-03-31 14:36  trainDemo\train\lib\javax.annotation.jar
     文件       47581  2019-03-31 14:36  trainDemo\train\lib\javax.ejb.jar
     文件       25957  2019-03-31 14:36  trainDemo\train\lib\javax.jms.jar
     文件      129793  2019-03-31 14:36  trainDemo\train\lib\javax.persistence.jar
     文件       44511  2019-03-31 14:36  trainDemo\train\lib\javax.resource.jar
     文件       69933  2019-03-31 14:36  trainDemo\train\lib\javax.servlet.jar
     文件       78836  2019-03-31 14:36  trainDemo\train\lib\javax.servlet.jsp.jar
     文件       28120  2019-03-31 14:36  trainDemo\train\lib\javax.servlet.jsp.jstl.jar
     文件        9714  2019-03-31 14:36  trainDemo\train\lib\javax.transaction.jar
............此处省略461个文件信息

评论

共有 条评论