2019.9.2课程设计情况

Posted hj609

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2019.9.2课程设计情况相关的知识,希望对你有一定的参考价值。

一、当天完成的任务

   今天开始搭服务器,我们使用eclipse配tomcat,然后android studio来做客户端。今天先把tomcat给配置完了,然后eclipse中的tomcat遇到一些问题,出现了error,争取今天晚上解决。

技术图片

 

  服务器端的代码:Login

技术图片
package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class LoginTest
 */
@WebServlet("/LoginTest")
public class Login extends HttpServlet 
    private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Login() 
        super();
        // TODO Auto-generated constructor stub
    
    public void init(ServletConfig config) throws ServletException 
        // TODO Auto-generated method stub
        super.init(config);
        try 
            Class.forName("com.mysql.jdbc.Driver");
         catch (Exception e) 
            // TODO Auto-generated catch block
            e.printStackTrace();
        
    
    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
        // TODO Auto-generated method stub
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        Connection con;
        Statement sql;
        String logname = request.getParameter("logname").trim();
        String password = request.getParameter("password").trim();
        String uri = "jdbc:mysql://localhost/MakeFriend";
        try 
            con = DriverManager.getConnection(uri,"root","201513010223");
            String condition = "select * from member where logname = ‘"+logname+"‘ and password = ‘"+password+"‘";
            sql = con.prepareStatement(condition);
            ResultSet rSet = sql.executeQuery(condition);
            if(rSet.next()) 
                out.println("login successfully!");
            
            else 
                out.println("can not login!");
            
            con.close();        
         catch (SQLException e) 
            // TODO Auto-generated catch block
            e.printStackTrace();
        
    

    /**
     * @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);
    

技术图片

 

二、第二天的计划

   将tomcat和eclipse配置完成,将服务器搭建完成。

三、每日小结

1.当初J2EE学得忘得差不多了,现在搭服务器感觉很费劲。

2.感觉走进了死胡同,死在了服务器里。

以上是关于2019.9.2课程设计情况的主要内容,如果未能解决你的问题,请参考以下文章

C语言课程设计:学生学籍管理系统。有谁有代码给我做个参考吗?谢谢了,C语言和C++的都可以。

2019.8.30课程设计情况

Firestore分层设计 - 课程,学生

2019.8.26课程设计情况

软件工程---课程设计总结

c语言程序设计题,高人来指点一下