1

I'm using TomEE. I was under impression that TomEE already has the JSF IMplementation Libraries.

So when create an Eclipse project, I follow the documentation and choose Library Provided By Target Runtime

enter image description here

It reads this facet requires jsf implementation library to be present on project classpath. By disabling library configuration, user takes on responsibility of configuring classpath appropriately via alternate means

So I go ahead and add all the bundled jars that come with TomEE ...\apache-tomee-webprofile-1.7.4\lib (this includes myfaces-api-2.1.17.jar and myfaces-impl-2.1.17.jar)


Then I Run on Server the following test xhtml . But it renders a blank page. Obviously, the xhtml was not compiled. So the bundled TomEE jars did NOT kick in. How can I make those bundled TomEE jars compile my test xhtml ?

<!DOCTYPE html>
<html lang="en"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:a="http://xmlns.jcp.org/jsf/passthrough">

    <h:head>
        <title>Hello World - Input Form</title>
    </h:head>
    <h:body>

        <h:form>
            <h:inputText id="name" value="#{theUserName}" 
                            a:placeholder="What's your name?" />

            <h:commandButton value="Submit" action="myresponse" />
        </h:form>

    </h:body>
</html>
Emily
  • 511
  • 3
  • 11
  • 23
  • 1
    You said yourself, TomEE already provides JSF libraries, why exactly are you still selecting "User Library" instead of "Library provided by Target Runtime"? – BalusC May 23 '16 at 07:19
  • @BalusC Because Eclipse does NOT compile `xhtml` unless I download `JSF` libraries – Emily May 23 '16 at 13:35
  • I added the detailed explanation. I understand that the test xhtml was simply not compiled . The `JSF` tags were not interpreted correctly . This can only happen if the `JSF` libraries did not kick in to interpret the tags – Emily May 23 '16 at 13:50
  • 1
    Is your blank page problem answered here? http://stackoverflow.com/q/3112946 If JSF libraries were not found, you'd get ClassNotFoundException on FacesServlet instead and the webapp deployment would block altogether. – BalusC May 23 '16 at 13:59
  • 1
    @BalusC Thank you very much. Just as you said the answer is there `change the from /faces/* to *.xhtml` – Emily May 23 '16 at 14:24
  • It is a duplicate. I'm not sure if I should delete it. Please let me know – Emily May 23 '16 at 14:26
  • Duplicates make search engines happy with new keywords. Deletions account towards question ban threshold. – BalusC May 23 '16 at 14:27

1 Answers1

1

TomEE has MyFaces as JSF implementation in tomee/lib folder. Worse case add it referencing myfaces-api there but ensure to not put it in the war during packaging.

Romain Manni-Bucau
  • 3,354
  • 1
  • 16
  • 13