-1

web.xml mapping is

<servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>

ErrorHandler servlet makes request

RequestDispatcher view = request.getRequestDispatcher("error.jsp");
view.forward(request, response);

jsp error-page contains the style

body {
        background-image: url(err-images/fon.png);
    }

How to display background image in error-page when url-pattern is wrong, for example http://localhost:8080/WEBSearchPrime_JB/wrong/register.xhtml

well, at leats one solution is to upload images to external hosting and using the absolute urls :)

andy007
  • 907
  • 1
  • 15
  • 41

1 Answers1

-2

Add a separate Page for the errors and configure the errors with their status port in web.xml file. like this

      <error-page>
      <error-code>400</error-code>
      <location>/WEB-INF/jsp/errorpages/ErrorPage400.jsp</location>
      </error-page> 

Like for wrong URL it will throws error msg with status port 404.

Naveen Kumar Mishra
  • 321
  • 1
  • 3
  • 16
  • There is no problem with opening error pages for me. The project error page opens but the images is not displaed. – andy007 Jun 01 '15 at 06:12
  • body { background-image: url(/err-images/fon.png); } or use this – Naveen Kumar Mishra Jun 01 '15 at 06:20
  • also You can check is any other css file is included on page try this also in the html/jsp page itself in body tag – Naveen Kumar Mishra Jun 01 '15 at 06:24
  • no, all that I've allready done as you could see from the question – andy007 Jun 01 '15 at 06:31
  • i have tried the same on myend and its working fine here.

    – Naveen Kumar Mishra Jun 01 '15 at 06:49
  • have you tried it with `jsf` project where `Faces Servlet` mapped to `/faces/*`? and that error page should appears with wrong path mapping, for example `http://localhost:8080/appname/wrong/pagename.xhtml` – andy007 Jun 01 '15 at 07:34
  • @BalusC i have that's why i suggested him to put the css explicitly in html tag only.if its a problem of jsf then the error page itself will not be rendered there. So defiantly its problem with image path or other css(may be included ) creating the problem . – Naveen Kumar Mishra Jun 01 '15 at 08:22