1
votes

Context: LiferayFaces + Eclipse IDE. liferay-plugins-sdk-6.2-ce-ga6, liferay-faces-bridge-api-3.2.4-ga5-sources.jar

Hi all:

As a begginer in the JSF programming world within Liferay Platform, I've started to create a JSF Portlet Project following the 'Creating a JSF Portlet' learning path. I've successfully created the JSF Portlet Project and deployed it on the Tomcat Server, and it's even working as expected.

The problem is that eclipse is displaying some errors in the facelet 'view.xhtml', despite of the fact that the portlet is working fine. The content of such file is:

<?xml version="1.0"?>
<f:view
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:aui="http://liferay.com/faces/aui"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
>
<h:head />
<h:body>
    <h:outputText value="#{i18n['guestbook-jsf-hello-world']}" />
</h:body>
</f:view>

And the errors I can see are:

  • should insert missing 'title' element (in the '' line) (in fact, it's not an error but a warning).
  • f:view is not recognized (in fact, is's a warning).
  • h:head is not recognized.
  • h:body is not recognized.
  • Self-closing syntax (/>) used on a non-void HTML element.

It seems that the JSF tags are not recognised, although the portlet is working fine. Can anyone explain to me what's going on with eclipse IDE and how I can prevent eclipse IDE from showing those errors messages? Thanks in advance.

Additional info (@BalusC): I think JSF Project has a facelet for the view mode, as the content of portlet.xml includes:

<portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
    <init-param>
        <name>javax.portlet.faces.defaultViewId.view</name>
        <value>/views/view.xhtml</value>
    </init-param>       
    <supports>
        <mime-type>text/html</mime-type>
        <portlet-mode>view</portlet-mode>
    </supports>

Moreover, within Project -> JavaResources -> Libraries -> Ivy you can find, among others, the following libraries:

  • jsf-api-2.1.21-sources.jar
  • jsf-impl-2.1.21-sources.jar
  • liferay-faces-util-3.2.4-ga5-sources.jar
  • liferay-faces-bridge-api-3.2.4-ga5-sources.jar
  • liferay-faces-bridge-impl-3.2.4-ga5-sources.jar
  • liferay-faces-portal-3.2.4-ga5-sources.jar

So the JSF implementation library do exists.

Moreover, within Project -> Properties -> Java Build Path -> Order and Export, all the entries are selected, so the JSF/LiferayFaces related libraries are included into the JSF Project.

Any idea/suggestion is welcome. Thanks.

1
Problem suggests project has no JSF facet and/or couldn't find JSF implementation library. Try explicitly adding the JSF implementation of interest to project's build path (not to deployment assembly or WEB-INF/lib!). Not exactly sure tho as I don't do Portlets (I only do Java EE). By the way, <h:head> is not a HTML element. Only that one in the generated HTML output is. - BalusC
@BalusC. Thanks for your consideration. Additional info included. BTW, <h:head /> is included by the wizard, it all is not my code. - txapeldot
I was just referring to "Self-closing syntax (/>) used on a non-void HTML element." which is nowhere visible in the code, so I guessed you assumed <h:head> for a HTML element. - BalusC
If I replace self-closing sintax by proper closing tags elements, all the errors dissapear but warning messages are shown: f:view is not recognized, h:head is not recognized, etc. Why does eclipse show this warning messages if the JSF-related libraries are linked within the project? - txapeldot
I don't do Portlets, but in a typical Java EE project this can happen if JSF facet is not enabled. Perhaps you need to look in project facets, or look for a better Portlet plugin for your IDE. - BalusC

1 Answers

0
votes

I cannot reproduce these issues anymore in Liferay Developer Studio (or Liferay IDE) 3.3.1+.