• 大小: 6.88MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-27
  • 语言: Java
  • 标签: jsp  java  html  源代码  

资源简介

基于JAVA EE的失物招领平台。本项目是基于Java EE的失物招领平台,主要面向日常生活中丢失物品或者拾取到物品的人。主要功能是帮助人们寻找不慎丢失的物品,或归还拾取到的物品。用户可在平台登录并输入丢失或拾取物品的信息,平台显示物品列表以供拾主或失主查找相应的物品,减少寻找物品或者捡到物品无法归还的麻烦。

资源截图

代码片段和文件信息


import java.io.IOException;
import java.io.PrintWriter;
import static java.lang.System.out;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author 33041
 */
@WebServlet(value = “{/deleteItem}“)
public class deleteItem extends HttpServlet {

    protected void processRequest(HttpServletRequest request HttpServletResponse response)
            throws ServletException IOException {
        request.setCharacterEncoding(“UTF-8“);
        response.setCharacterEncoding(“UTF-8“);
        response.setContentType(“text/html;charset=UTF-8“);
        PreparedStatement ps = null;
        JDBCConnector jd = (JDBCConnector)getServletContext().getAttribute(“jd“);
        Connection con = jd.getConnection();
        try {
            String sql = “delete from items where itemId = ?“;
            ps = con.prepareStatement(sql);
            ps.setInt(1 Integer.parseInt(request.getParameter(“itemId“)));
            ps.executeUpdate();

            response.sendRedirect(“lostlist.jsp“);

        } catch (Exception e) {
            out.println(e);
        }
    }

    // 
    /**
     * Handles the HTTP GET method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request HttpServletResponse response)
            throws ServletException IOException {
        processRequest(request response);
    }

    /**
     * Handles the HTTP POST method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doPost(HttpServletRequest request HttpServletResponse response)
            throws ServletException IOException {
        processRequest(request response);
    }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return “Short description“;
    }// 

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-09-12 22:02  lostandfound\
     目录           0  2020-09-10 16:24  lostandfound\build\
     目录           0  2020-09-10 16:24  lostandfound\build\empty\
     目录           0  2020-09-10 16:24  lostandfound\build\generated-sources\
     目录           0  2020-09-10 16:24  lostandfound\build\generated-sources\ap-source-output\
     目录           0  2020-09-10 16:24  lostandfound\build\web\
     文件        2101  2020-09-10 16:24  lostandfound\build\web\foundentry1.html
     文件        3607  2020-09-10 16:24  lostandfound\build\web\foundlist.jsp
     文件        1466  2020-09-10 16:25  lostandfound\build\web\index.html
     文件        3440  2020-09-10 16:24  lostandfound\build\web\itemDetail.jsp
     目录           0  2020-09-10 16:24  lostandfound\build\web\logincss\
     目录           0  2020-09-10 16:24  lostandfound\build\web\logincss\web\
     目录           0  2020-09-10 16:24  lostandfound\build\web\logincss\web\css\
     文件        8786  2020-09-10 16:24  lostandfound\build\web\logincss\web\css\style.css
     目录           0  2020-09-10 16:24  lostandfound\build\web\logincss\web\images\
     文件        3008  2020-09-10 16:24  lostandfound\build\web\logincss\web\images\1.png
     文件        2984  2020-09-10 16:24  lostandfound\build\web\logincss\web\images\2.png
     文件        3027  2020-09-10 16:24  lostandfound\build\web\logincss\web\images\3.png
     文件        1008  2020-09-10 16:24  lostandfound\build\web\logincss\web\images\4.png
     文件        5632  2020-09-10 16:24  lostandfound\build\web\logincss\web\images\Thumbs.db
     文件        2912  2020-09-10 16:24  lostandfound\build\web\logincss\web\images\tick.png
     文件        2100  2020-09-10 16:24  lostandfound\build\web\lostentry1.html
     文件        3594  2020-09-10 16:24  lostandfound\build\web\lostlist.jsp
     目录           0  2020-09-10 16:24  lostandfound\build\web\meta-INF\
     文件          72  2020-09-10 16:24  lostandfound\build\web\meta-INF\context.xml
     文件          25  2020-09-10 16:24  lostandfound\build\web\meta-INF\MANIFEST.MF
     文件        2509  2020-09-10 16:24  lostandfound\build\web\navigation.html
     文件        1716  2020-09-10 16:24  lostandfound\build\web\signup.html
     目录           0  2020-09-10 16:24  lostandfound\build\web\WEB-INF\
     目录           0  2020-09-10 16:24  lostandfound\build\web\WEB-INF\classes\
     文件           0  2020-09-10 16:24  lostandfound\build\web\WEB-INF\classes\.netbeans_automatic_build
............此处省略65个文件信息

评论

共有 条评论