I've created a Java web app (EE 8) that runs on the tomcat 10 server but doesn't work with URL(href link) in an index.JSP page; I haven't changed anything in the generated application. but throws 404 code in the "http://localhost:8080/hello-servlet" url. how to map URL with @webSevlet annotations.
@WebServlet(name = "helloServlet", value = "/hello-servlet")
public class HelloServlet extends HttpServlet {
private String message;
public void init() {
message = "Hello World!";
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException
{
response.setContentType("text/html");
// Hello
System.out.println("Get Requests");
PrintWriter out = response.getWriter();
out.println("<html><body>");
out.println("<h1>" + message + "</h1>");
out.println("</body></html>");
}
public void destroy() {
}
}
