Question

I am trying to fix https://stackoverflow.com/questions/21162117/simplecrud-rejects-user-password and guys from TomEE mailing list asked me to reproduce the bug using Maven. So I followed Apache guide

I created a new directory, then I entered command

mvn archetype:generate -DarchetypeGroupId=org.apache.openejb.maven -DarchetypeArtifactId=tomee-webapp-archetype -DarchetypeVersion=1.0.1

then

cd tomee-demo

then

mvn package tomee:run

then I putted war file in

maven/tomee-demo/target/apache-tomee/webapps/

And tried to load webpage

http://localhost:8080/LAI_pezzi_Login/Login.xhtml

But I obtain the message

The specified XML file does not have any associated style sheet. Document tree is shown below

<ui:composition template="/templates/layout.xhtml">
<ui:define name="content">
<h:form styleClass="loginPanelStyle">
<p:growl id="msgs" showDetail="true" sticky="false"/>
<p:panelGrid columns="2">
<f:facet name="header"> Login Panel </f:facet>
<h:outputText value="Username : "/>
<p:inputText id="username" value="#{loginController.username}" required="true" requiredMessage="Please Enter Username!" message="fc">
<f:validateLength minimum="1"/>
</p:inputText>
<h:outputText value="Password : "/>
<p:password id="password" value="#{loginController.password}" required="true" requiredMessage="Please Enter password!">
<f:validateLength minimum="1"/>
</p:password>
<f:facet name="footer">
<p:commandButton value="Submit" update="msgs" actionListener="#{loginController.login}" icon="ui-icon-check" style="margin:0"/>
</f:facet>
</p:panelGrid>
</h:form>
</ui:define>
</ui:composition>

I also tried to deploy the WAR file on a Tomcat downloaded from Apache website, and the WAR file works correctly

Était-ce utile?

La solution

As discussed in the comments, you need to tell JSF which URLs it should process by specifying a servlet-mapping in your web.xml:

<servlet-mapping>
  <servlet-name>FacesServlet</servlet-name>
  <url-pattern>*.xhtml<‌​/url-pattern>
</servlet-mapping>

Your experience with left-over configuration files reminds me why I touch maven with a 10' pole only.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top