Error JSP not displayed - HTTP Status 404 - Not Found

Asked

Viewed 236 times

0

inserir a descrição da imagem aqui

jsp code to display error messages:

<%@ page isErrorPage="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<title>Show Error Page</title>
</head>

<body>
    <h1>Opps...</h1>
    <p>Sorry, an error occurred.</p>
    <p>Here is the exception stack trace:</p>

    <select>
        <c:forEach items="${erros}" var="e">
            <option value="${e.getMessage()}"></option>
        </c:forEach>
    </select>
    <br/>

    Clicar<a href="login.jsp">Login</a>
</body>
</html>

Web.xml:

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:javaee="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<!-- <display-name>Servlet 3.0 Web Application</display-name> -->

<servlet>
    <servlet-name>ControllerServlet</servlet-name>
    <jsp-file>/pages/login.jsp</jsp-file>
</servlet>

<servlet-mapping>
    <servlet-name>ControllerServlet</servlet-name>
    <url-pattern>/pages/*</url-pattern>
</servlet-mapping>

<welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
    <welcome-file>loginsuccess.jsp</welcome-file>
    <welcome-file>usuariosList.jsp</welcome-file>
    <welcome-file>novoUsuario.jsp</welcome-file>
</welcome-file-list>

<error-page>
    <exception-type>java.lang.RuntimeException</exception-type>
    <location>/WEB-INF/pages/errors.jsp</location>
</error-page>

<!-- <error-page>
    <error-code>404</error-code>
    <location>/WEB-INF/error-404.jsp</location>
</error-page> -->

  • I don’t quite understand what you are trying to do... You forced an error in your application to try to test the error page /WEB-INF/pages/errors.jsp, and instead gave error 404? Is that the problem? If that’s it, I realized that in your XML you set the error page to errors.jsp, but in your screenshot is erros.jsp (one letter is missing r). Did you not get confused and created the file with that wrong name within the project?

  • That then I had noticed and corrected, the problem is that I am not able to load a list of exceptions that on this page, after the validation of the attributes of the object. Or login screen. that’s my problem!

  • The problem still remains

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.