JSF 2 with HTML pages instead of XHTML

后端 未结 2 1600
臣服心动
臣服心动 2020-12-07 03:12

I am trying to get JSF setup to use files with a html extension.

If I use a .xhtml pattern (*.xhtml) and name my

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-07 03:32

    However, if I change this to *.html and naming the files with a .html extension, I get 500 an error

    Did you mean that you renamed the physical .xhtml files to .html? You should not have the need to do that. Rename them back to .xhtml and keep using the .html in URLs. The FacesServlet will automatically load the right XHTML file associated with the URL.

    If you really need to give them the .html extension, then you'd need to change the default suffix to .html as well. Add the following entry to web.xml to achieve that:

    
        javax.faces.DEFAULT_SUFFIX
        .html
    
    

    See also:

    • JSF Facelets: Sometimes I see the URL is .jsf and sometimes .xhtml. Why?
    • Is it possible to use JSF+Facelets with HTML 4/5?

提交回复
热议问题