jsp - Custom 404 error page not displayed -


i trying give custom error page application pagenotfound or nullpointerexception using below code,

web.xml :

<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0">   <display-name>raptor 1-5</display-name>   <welcome-file-list>     <welcome-file>loginpage.jsp</welcome-file>   </welcome-file-list>   <error-page>   <error-code>404</error-code>   <location>/404errorpage.jsp</location>   </error-page>    <error-page>   <exception-type>pagenotfoundexception</exception-type>   <location>/404errorpage.jsp</location>   </error-page>  </web-app> 

urlsecuritycheckingpage.jsp :

<%@ page language="java" contenttype="text/html; charset=utf-8"     pageencoding="utf-8" iserrorpage="true" errorpage="404errorpage.jsp" %> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>insert title here</title> </head> <body>  <h1>break url , check whether displays custom 404 error page or not.</h1>  </body> </html> 

404errorpage.jsp :

<%@ page language="java" contenttype="text/html; charset=utf-8"     pageencoding="utf-8"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>insert title here</title> </head> <body> <h1>this page may broken or not valid.</h1> <br> <a href="loginpage.jsp">click here login page.</a> </body> </html> 

when give real path http://localhost:8080/raptor1-5/urlsecuritycheckingpage.jsp displays page when give incomplete url http://localhost:8080/raptor1-5/urlsecuritycheckingpa shows default 404 error page instead of custom error page.

how fix this? doing wrong?


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -