index.jsp でコーディングされたページを表示する必要があり、このページでは onload submit を使用しました
<script type="text/javascript">
    function myfunc () {
    var frm = document.getElementById("my_form");
    frm.submit();
    }
    window.onload = myfunc;
</script>
<form id="my_form" action="tempmonitor" method="post">
上記は私のjspコードで、このページにhelloを印刷しました。しかし、URL localhost:8090/tempmonitoringsystem/index.jsp にアクセスすると、. nanosec den の index.jsp が次の URL localhost:8090/tempmonitoringsystem/tempmonitor に移動したことを示しており、どこにリダイレクトされているのかわかりません。サーブレット コードと xml コードを添付しています。
TempMonitorServlet.java
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    System.out.println("hello world");
    String path = "E:\\"; 
      String files;
      File folder = new File(path);
      File[] listOfFiles = folder.listFiles(); 
      for (int i = 0; i < listOfFiles.length; i++) 
      {      
          if (listOfFiles[i].isFile()) 
          {
              files = listOfFiles[i].getName();
              if (files.endsWith(".txt") || files.endsWith(".TXT"))
              {
                  System.out.println(files);
                  ReadingFromFile read_file = new ReadingFromFile();
                  String last_line_from_file = read_file.read(files) ;
                  System.out.println("\n"+last_line_from_file);
                  if(last_line_from_file != null)
                  {
                      drawImage(req,resp ,last_line_from_file,files) ;
                  }
              }
          }
      }
}
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>ZigbeeRest</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
<servlet>
<servlet-name>tempmonitor</servlet-name>
<servlet-class>tempmonitor.TempMonitorServlet
</servlet-class>
    <init-param>
        <param-name>javax.ws.rs.Application</param-name>
        <param-value>com.restful.Zigbee.services.ZigbeeApplication</param-value>
    </init-param>
</servlet>
<servlet-mapping>
    <servlet-name>tempmonitor</servlet-name>
    <url-pattern>/tempmonitor</url-pattern>
</servlet-mapping>