jsp - Send error with attribute -


i'm sending custom error page 404 in jsp. want know if possible add attributes page, request dispatcher it.

i have user session bar information, name, , other things, , want page contains same top bar. possible in way of sending error pages?

thanks.

you can define custom error pages in web.xml , can access session in error-page code.

<error-page>   <error-code>400</error-code>   <location>/web-inf/jsp/errorpages/errorpage400.jsp</location> </error-page> 

web.xml described here: http://docs.oracle.com/cd/e13222_01/wls/docs81/webapp/web_xml.html

look @ documentation oracle here: https://docs.oracle.com/cd/e19316-01/819-3669/bnahi/index.html

for example, error page duke’s bookstore follows:

<%@ page iserrorpage="true" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core"      prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"      prefix="fmt" %> <html> <head> <title><fmt:message key="servererror"/></title> </head> <body bgcolor="white"> <h3> <fmt:message key="servererror"/> </h3> <p> : ${pagecontext.errordata.throwable.cause} </body> </html> 

Comments