The solution to The requested resource is not available in the front-end development of the web



HTTP Status 404 (The requested resource is not available)": The exception is mainly caused by ① path error ② spelling error

The workaround is as follows:

1. Web application is not deployed;

2. URL is entered incorrectly;

      a. Check whether the IP address and port number of the URL are written correctly;

      b. Check whether the context path is correct Project-------Properties------MyElipse-----Web----- Web Context-root Check whether the path name is written correctly;

      c. Check whether the file name is written correctly;

3. Directory cannot be referenced

      Check where the files are stored in Eclipse's "Package Explorer". Since the content in the META-INF WEB-INF folder cannot be published externally, if you reference files with these two directories, it is definitely not allowed

eg: http://localhost:8080/guestbook/WEB-INF/index.html is wrong, the file location is wrong

4. Problem in web.xml in Tomcat server

If your web application has multiple jsp pages, you may get a 404 error when you click on the virtual root directory of your web application, but you only need to modify the web.xml in the Tomcat server

<init-param>

    <param-name>listing</param-name>

    <param-value>false (change it to true)</param-value>

</init-param>

5. There must be several fixed folders and files under WEB-INF

 web.xml configuration file for the web app;

lib The library file used by the web app;

 classes store the compiled servlet;

<servlet>

    <servlet-name>HelloWorldServletservlet-name

    <servlet-class>HelloWorldServlet</servlet-class>

</servlet>

 Please pay attention to their names, so as not to misspelled wasted effort to find errors.

 6. If you want to run a servlet (.class) file instead of a .jsp file, configure web.xml (under WEB-INF, of course), and add the following fields:

<servlet>

       <servlet-name>HelloWorldServlet<servlet-name>

         <servlet-class>HelloWorldServlet</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>HelloWorldServlet</servlet-name>

<url-pattern>/HelloWorldServlet</url-pattern>

</servlet-mapping>

Where "HelloWorldServlet" is changed to the file name you want to run .





Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325713654&siteId=291194637