Why does this text not appear in JSF?

后端 未结 1 1106
误落风尘
误落风尘 2021-01-23 14:29

I have the following HTML file:





        
相关标签:
1条回答
  • 2021-01-23 14:41

    That can happen if the request URL as you see in browser's address did not match the <url-pattern> of the FacesServlet as definied in webapp's web.xml and hence the FacesServlet wasn't able to do its job of performing all the JSF works.

    If you right click the page in browser and do View Source, you should have noticed that the JSF <h:outputText> tag is completely unprocessed. JSF tags aren't recognized by the webbrowser. They are supposed to be processed by the FacesServlet in the webserver. They are supposed to generate proper HTML code and the final HTML result should not contain any JSF tags at all.

    You need to make sure that the request URL as you see in browser's address matches the <url-pattern> of the FacesServlet as definied in webapp's web.xml. Imagine that it is *.jsf like as

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

    then you should need to change the URL in the address bar from /some.xhtml to /some.jsf.

    Alternatively, you could also just change the web.xml to map the FacesServlet on *.xhtml directly

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

    so that you don't need to fiddle with virtual URLs anymore.

    As to the file having HTML5 doctype, no that makes absolutely no difference. I'd only remove that XML prolog as that's valid for XHTML doctype only. See also Is it possible to use JSF+Facelets with HTML 4/5?

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