• 大小: 1.56MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-24
  • 语言: Java
  • 标签: jsp  sevlet  javabean  jdbc  

资源简介

采用mvc结构开发的,利用了jsp、servlet、javabean,采用jdbc作为数据库连接,采用mysql数据库。

资源截图

代码片段和文件信息

package com.atoz.survey.control;

import com.atoz.survey.dao.PaperDao;
import com.atoz.survey.dao.mysqlimpl.PaperDaoImpl;
import com.atoz.survey.po.Paper;
import com.atoz.survey.po.User;

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 java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class AddPaper extends HttpServlet {

/**
 * Constructor of the object.
 */
public AddPaper() {
super();
}

/**
 * Destruction of the servlet. 

 */
@Override
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
 */
@Override
public void doGet(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {

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
 */
@Override
public void doPost(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {

System.out.println(“进入AddPaper servlet“);
PaperDao paperDao = new PaperDaoImpl();

Paper paper = new Paper();

HttpSession session = request.getSession();

User user = (User) session.getAttribute(“userInfo“);
System.out.println(“输出用户id“);
System.out.println(user.getUserId());
int userId = user.getUserId();

paper.setUserId(userId);

String papertitle0 = request.getParameter(“papertitle“);
String papertitle = new String(papertitle0.getBytes(“ISO-8859-1“)“utf-8“);
paper.setPapertitle(papertitle);

String paperTypeString = request.getParameter(“paperType“);
int paperType = Integer.parseInt(paperTypeString);
paper.setPaperType(paperType);

String paperSummary0 = request.getParameter(“paperSummary“);
String paperSummary = new String(paperSummary0.getBytes(“ISO-8859-1“)“utf-8“);
paper.setPaperSummary(paperSummary);

String paperBg = request.getParameter(“paperBg“);
paper.setPaperBg(paperBg);

//发布日期
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss“);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-01-09 19:59  wenwen\
     目录           0  2018-04-08 23:39  wenwen\.idea\
     目录           0  2018-01-09 19:59  wenwen\.idea\artifacts\
     文件         281  2017-06-29 23:43  wenwen\.idea\artifacts\wenwen_war.xml
     文件         655  2017-07-01 22:56  wenwen\.idea\artifacts\wenwen_war_exploded.xml
     文件         637  2017-12-04 22:14  wenwen\.idea\compiler.xml
     目录           0  2018-04-08 23:34  wenwen\.idea\dataSources\
     文件         754  2018-04-08 23:34  wenwen\.idea\dataSources.local.xml
     文件         889  2017-07-02 09:22  wenwen\.idea\dataSources.xml
     目录           0  2018-04-08 23:34  wenwen\.idea\dataSources\d02b4419-d184-4c23-8dda-6df427227049\
     文件        5056  2017-07-02 09:22  wenwen\.idea\dataSources\d02b4419-d184-4c23-8dda-6df427227049.xml
     文件         124  2018-04-08 23:34  wenwen\.idea\dataSources\d02b4419-d184-4c23-8dda-6df427227049\storage.xml
     目录           0  2018-04-08 23:34  wenwen\.idea\dataSources\d02b4419-d184-4c23-8dda-6df427227049\_src_\
     目录           0  2018-04-08 23:34  wenwen\.idea\dataSources\d02b4419-d184-4c23-8dda-6df427227049\_staging_\
     文件         200  2017-07-01 22:01  wenwen\.idea\encodings.xml
     目录           0  2018-01-09 19:59  wenwen\.idea\libraries\
     文件         199  2017-07-01 23:00  wenwen\.idea\libraries\junit4_4.xml
     文件         514  2017-06-29 23:43  wenwen\.idea\libraries\Maven__aopalliance_aopalliance_1_0.xml
     文件         616  2017-06-29 23:43  wenwen\.idea\libraries\Maven__commons_collections_commons_collections_3_2_1.xml
     文件         572  2017-06-29 23:43  wenwen\.idea\libraries\Maven__commons_logging_commons_logging_1_1_1.xml
     文件         644  2017-06-29 23:43  wenwen\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_annotations_2_5_0.xml
     文件         595  2017-06-29 23:43  wenwen\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_core_2_5_1.xml
     文件         623  2017-06-29 23:43  wenwen\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_databind_2_5_1.xml
     文件         499  2017-06-29 23:43  wenwen\.idea\libraries\Maven__com_google_guava_guava_17_0.xml
     文件         493  2017-06-29 23:43  wenwen\.idea\libraries\Maven__com_mchange_c3p0_0_9_5_1.xml
     文件         598  2017-06-29 23:43  wenwen\.idea\libraries\Maven__com_mchange_mchange_commons_java_0_2_10.xml
     文件         455  2017-06-29 23:43  wenwen\.idea\libraries\Maven__junit_junit_4_12.xml
     文件         469  2017-06-29 23:43  wenwen\.idea\libraries\Maven__log4j_log4j_1_2_17.xml
     文件         574  2017-06-29 23:43  wenwen\.idea\libraries\Maven__mysql_mysql_connector_java_5_1_22.xml
     文件         556  2017-06-29 23:43  wenwen\.idea\libraries\Maven__org_apache_commons_commons_lang3_3_4.xml
     文件         532  2017-06-29 23:43  wenwen\.idea\libraries\Maven__org_hamcrest_hamcrest_core_1_3.xml
............此处省略245个文件信息

评论

共有 条评论