today's task at work was to find out how to hide xhtml tag code in jsf pages, i.e. when a user attempts "view > source code", we don't want them to see the non-rendered jsf tags. i searched a lot, using the following search phrases:
jsf hide source code
primefaces hide source code
jsf don't show source code
jee hide jsf source code
jee web.xml hide jsf source
hide xhtml source
jsf disable viewing xhtml source
but surprisingly found no concrete answer as to how to solve this, but after much trial and error, i've finally figured it out.
put this code in your web.xml:
<servlet>
<servlet-name>facesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>facesServlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.xhtml</url-pattern>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
No comments:
Post a Comment