开发者

How can I make JSF 2.0 page with .jsf extension?

开发者 https://www.devze.com 2023-02-19 17:01 出处:网络
The default one is xhtml. I want to change it to .jsf. Is this possible using facelets/jsp or using an开发者_JAVA技巧yone of these two?I think your asking about changing the servlet mapping so you ca

The default one is xhtml. I want to change it to .jsf.

Is this possible using facelets/jsp or using an开发者_JAVA技巧yone of these two?


I think your asking about changing the servlet mapping so you can go to http://website/index.jsf instead of something like http://website/faces/index.xhtml. To do this change your url-pattern in your web.xml .

<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>

I didn't have to change the .xhtml file extension of the index file in my project for this to work.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号