gpt4 book ai didi

java - 当我在 webapps 文件夹中加载我的 webapp 时,我在 WEB-INF/classes 中的类文件被删除

转载 作者:行者123 更新时间:2023-11-29 00:01:37 26 4
gpt4 key购买 nike

<分区>

我正在使用 Tomcat 5,当我启动服务器并从 webapp 文件夹加载我的应用程序时,我的 JSP 会加载,但是 WEB-INF/classes 中的类文件会被自动删除 当我加载类文件时它会抛出这个:

this is the error

我的 servlet 类文件正在删除/不知道它去了哪里。

  This is my `web.xml` file inside `WEB-INF/` .classes mapped inside `web.xml` is in `WEB-INF/classes`. All class files inside this is getting erased.

<?xml version="1.0" encoding="ISO-8859-1"?>


<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0"
metadata-complete="true">

<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>
<servlet>
<servlet-name>HelloForm</servlet-name>
<servlet-class>HelloForm</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>HelloForm</servlet-name>
<url-pattern>/HelloForm</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Upload</servlet-name>
<servlet-class>Upload</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Upload</servlet-name>
<url-pattern>/Upload</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Getapplicants</servlet-name>
<servlet-class>Getapplicants</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Getapplicants</servlet-name>
<url-pattern>/Getapplicants</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>First_round_selected</servlet-name>
<servlet-class>First_round_selected</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>First_round_selected</servlet-name>
<url-pattern>/First_round_selected</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>Second_round_selected</servlet-name>
<servlet-class>Second_round_selected</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Second_round_selected</servlet-name>
<url-pattern>/Second_round_selected</url-pattern>
</servlet-mapping>



</web-app>

坚持这一点:

上传.java:

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
// Extend HttpServlet class
public class Upload extends HttpServlet {

// Method to handle GET method request.
public void doGet(HttpServletRequest request, HttpServletResponse
response)throws ServletException, IOException {
PrintWriter out = response.getWriter();
String first_name=request.getParameter("first_name");
String last_name=request.getParameter("last_name");
String email=request.getParameter("email");
String phone_number=request.getParameter("phone_number");
String experience =request.getParameter("experience");

try{
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/interview"
,"root","
");
Statement stmt=con.createStatement();
int rows=stmt.executeUpdate("insert into applicants
values('"+first_name+"','"+last_name+"','"+email+"',"+
Long.valueOf(phone_number
)+","+Integer.valueOf(experience)+")");
con.close();
out.print("Added Sucessfully");


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


public void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {

doGet(request, response);
}
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com