JSF page rendering error:Faces Context

后端 未结 2 1311
[愿得一人]
[愿得一人] 2021-01-17 05:42

I am getting the below messages when my JSF page gets rendered. The page is rendered correctly however in the Console the message below repeats itself numerous times...

相关标签:
2条回答
  • 2021-01-17 06:00

    This error basically means that the request URL (the one which you see in the browser address bar, or the one which is used to include/dispatch the desired page) does not match the url-pattern of the FacesServlet's mapping as definied in the web.xml. You need to let the request URL match it to invoke the FacesServlet.

    So if it is for example the following suffix-pattern (extension mapping):

    <url-pattern>*.jsf</url-pattern>
    

    then you need to ensure that your request URL matches it, i.e. use http://example.com/context/page.jsf instead of http://example.com/context/page.jsp.

    Or if it is for example the following prefix-pattern (directory mapping):

    <url-pattern>/faces/*</url-pattern>
    

    then you need to ensure that your request URL look like http://example.com/context/faces/page.jsp instead of http://example.com/context/page.jsp.

    Edit: although I wouldn't use multiple url-patterns for the FacesServlet and just stick to one, but the mapping seems to look fine. After all, the error message thus comes from com.web.util.faces.UtilFacesFuncs. That look like a homegrown utility class. What exactly is that class doing? Isn't it just a bug in that utility class that it for example is trying to access the FacesContext too early or too late in the request?

    0 讨论(0)
  • 2021-01-17 06:19

    Sorry my comment I added above did not come across correctly, here is what I have in my web.xml: Also my url I use is http://localhost.com/context/register/mypage.htm I have these jsp under the folder register. I can call other jsp from the register folder and this error does not appear.... just happens for this particular jsp that I have added.

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

    I am trying to add my full mappings but the way the code tags work here, it is not coming across since hte mappings have tags... I tried blockquotes provided, but still this editor is not able to display my mappings correctly, apologies!

    Any idea how I should be calling my url. Thanks.

    0 讨论(0)
提交回复
热议问题