zoukankan      html  css  js  c++  java
  • 2021 4 15

    云相册服务器servlet:

    package servlet;
    
    import java.io.DataOutputStream;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import dao.dao;
    
    /**
     * Servlet implementation class signinservlet
     */
    @WebServlet("/signinservlet")
    public class signinservlet extends HttpServlet {
        private static final long serialVersionUID = 1L;
           
        /**
         * @see HttpServlet#HttpServlet()
         */
        public signinservlet() {
            super();
            // TODO Auto-generated constructor stub
        }
    
        /**
         * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
         */
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            request.setCharacterEncoding("utf-8");
            response.setContentType("text/html;charset=utf-8");    
            dao p=new dao();
            String name=request.getParameter("name");
            String passwd=request.getParameter("passwd");    
            DataOutputStream os=new DataOutputStream(response.getOutputStream());
            switch(p.signin(name,passwd))
            {
                case 1:os.writeUTF("注册成功!");break;
                case 2:os.writeUTF("用户名已存在!");break;
            }
        }
        /**
         * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
         */
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            // TODO Auto-generated method stub
            doGet(request, response);
        }
    
    }
    package servlet;
    
    import java.io.DataOutputStream;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import dao.dao;
    
    /**
     * Servlet implementation class getphotoid
     */
    @WebServlet("/getphotoid")
    public class getphotoid extends HttpServlet {
        private static final long serialVersionUID = 1L;
        /**
         * @see HttpServlet#HttpServlet()
         */
        public getphotoid() {
            super();
            // TODO Auto-generated constructor stub
        }
    
        /**
         * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
         */
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            request.setCharacterEncoding("utf-8");
            response.setContentType("text/html;charset=utf-8");    
            dao p=new dao();
            String id=request.getParameter("id");
            StringBuffer a=p.getphotolist(id);
            DataOutputStream os=new DataOutputStream(response.getOutputStream());
            os.writeUTF(a.toString());
        }
        /**
         * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
         */
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            // TODO Auto-generated method stub
            doGet(request, response);
        }
    
    }
    package servlet;
    
    import java.io.DataOutputStream;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import dao.dao;
    
    /**
     * Servlet implementation class comment_servlet
     */
    @WebServlet("/comment_servlet")
    public class comment_servlet extends HttpServlet {
        private static final long serialVersionUID = 1L;
           
        /**
         * @see HttpServlet#HttpServlet()
         */
        public comment_servlet() {
            super();
            // TODO Auto-generated constructor stub
        }
    
        /**
         * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
         */
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            request.setCharacterEncoding("utf-8");
            response.setContentType("text/html;charset=utf-8");    
            dao p=new dao();
            String id=request.getParameter("id");
            String comment=request.getParameter("comment");
            String time=request.getParameter("time");
            p.addcomment(id, comment, time);
            DataOutputStream os=new DataOutputStream(response.getOutputStream());
            os.writeUTF("评论成功!");
        }
    
        /**
         * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
         */
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            // TODO Auto-generated method stub
            doGet(request, response);
        }
    
    }
  • 相关阅读:
    经典网络复现(0)多层感知机和lenet
    将自有数据集下yolov训练结果(*.weights) 在进行部署
    DL基础学习计划
    自有数据集上使用keras训练YOLOv3目标检测
    《基于深度学习的图像语义分割方法综述》阅读理解
    Hessian矩阵以及在血管增强中的应用—OpenCV实现
    QML官方例子Calculator初步解析
    human_pose_estimation_demo的再进一步研究(基于OpenPOSE)
    10年图像处理工程师学习图像处理的小结
    human_pose_estimation_demo的进一步研究(基于OpenPOSE)
  • 原文地址:https://www.cnblogs.com/fuxw4971/p/14910393.html
Copyright © 2011-2022 走看看