0

I'm getting the error after clicking on "MyServlet Page" link , after running the project "FirstServlet".

This is my file structure

enter image description here

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
    <servlet>
        <servlet-name>hello</servlet-name>
        <servlet-class>MyServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>hello</servlet-name>
        <url-pattern>/hello</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
</web-app>

index.html

<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <div>Click here, to go <a href= "hello"> MyServlet Page.</a></div>
    </body>
</html>
andrewJames
  • 19,570
  • 8
  • 19
  • 51
  • See also [Servlet returns "HTTP Status 404 The requested resource (/servlet) is not available"](https://stackoverflow.com/q/11731377/12567365). – andrewJames Aug 28 '22 at 14:40

1 Answers1

0

In your href html code the gap between the equal sign and the double quote should be removed so the equal sign and double quote are connected.

Samuel Marchant
  • 331
  • 2
  • 6