Eclipse Kepler 4.3.1 Error in New Facelet Template

As part of my class preparation I have been writing blog entries on setting up a JEE 6 web profile Maven projects in Eclipse and in NetBeans using the TomEE server. Once I got that working I proceeded to try out a tutorial from Eclipse called the JSF Tools Tutorial – JSF 2.0 that is found in the Eclipse help system.

Create a new project based on my previous blog “Creating JavaServer Faces Maven Managed Projects with Eclipse” and not as described in the tutorial. Jump to the section entitled “Create Facelets template pages”. At this step you are instructed to create a New Facelet Template named BasicTemplate.xhtml. The code that is generated is not what appears in the tutorial.

This is not a problem because the tutorial provides the code and you can just cut and paste it into your BasicTemplate.xhtml file. There is one line that I wanted to leave as is:

<ui:debug hotkey="x" 
      rendered="#{initParam['javax.faces.FACELETS_DEVELOPMENT']}"/>

The problem was that this line gets a warning symbol in the editor that states that there is an EL syntax error. After some research I discovered the following. In the web.xml file there is the following entry:

<context-param>
   <param-name>javax.faces.PROJECT_STAGE</param-name>
   <param-value>Development</param-value>
</context-param>

This is a description of the current stage of the project. In this case it is Development. The other possible values are UnitTest, SystemTest, Production and Extension.

The <ui:debug> tag is referring to a parameter no longer used called FACELETS_DEVELOPMENT. So I changed the tag to:

<ui:debug hotkey="x" 
rendered="#{initParam['javax.faces.PROJECT_STAGE']}"/>

This was not sufficient because there are four possible stages. A little more research uncovered the solution as found at JSF Toolbox

<ui:debug hotkey="x" 
rendered="#{initParam['javax.faces.PROJECT_STAGE'] 
eq 'Development'}"/>

With this change the tutorial project’s errors or warnings were removed and it ran as expected. When viewing the pages in the browser you can press Ctrl-Shift-X to get to the JSF debugging windows. Cool!

 

 

 

Email this to someoneTweet about this on TwitterShare on LinkedIn0Share on Facebook0

Leave a Reply

Your email address will not be published. Required fields are marked *