1

first sorry my bad english I'm a non english speaker,I have a small JSF 2.3 maven project that I'm using to test primefaces but currently it doesn't display multiple tags correctly an example is the p:inputText I copied the code from the PrimeFaces showcase. Currently I'm using Eclipse 4.12.

Here is the picture from the xhtml render.

Image

This is my index.xhtml

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:p="http://primefaces.org/ui">
<h:head>
    <title>Example</title>
</h:head>
<h:body>
    <h:form>
        <h3>Floating Label</h3>
        <span class="ui-float-label"> <p:inputText id="float-input"
                value="#{user.name}" /> <p:outputLabel
                for="@previous" value="Username" />
        </span>
    </h:form>
</h:body>
</html>

faces-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd"
    version="2.3">
</faces-config>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
    version="4.0">
    <display-name>SDUYR</display-name>
    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
        <welcome-file>Index.xhtml</welcome-file>
    </welcome-file-list>
    <context-param>
        <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
        <param-value>0</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.validator.ENABLE_VALIDATE_WHOLE_BEAN</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.ENABLE_CDI_RESOLVER_CHAIN</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.ENABLE_WEBSOCKET_ENDPOINT</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.WEBAPP_RESOURCES_DIRECTORY</param-name>
        <param-value>/WEB-INF/resources</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.FONT_AWESOME</param-name>
        <param-value>true</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>30</sessi[enter link description here][1]on-timeout>
    </session-config>
</web-app>

Used maven dependency

<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version>7.0</version>
</dependency>
  • Hi, by using the tags you use, you effective state it works if you don't use maven or if you use javaee7. See [tags] – Kukeltje Jul 25 '19 at 07:06
  • JFYI: javax.faces.ENABLE_CDI_RESOLVER_CHAIN doesnt exist – tandraschko Jul 25 '19 at 07:59
  • Indeed this was never documented in any official JSF tutorial/book. Rene, where exactly did you learn/read that you should be using the `javax.faces.ENABLE_CDI_RESOLVER_CHAIN`? Then I can correct the source. – BalusC Jul 25 '19 at 08:37
  • @BalusC I took the example from this blog [Activating CDI in JSF](http://hantsy.blogspot.com/2017/11/activating-cdi-in-jsf-23.html) – Rene Nochebuena Jul 26 '19 at 03:33
  • @tandraschko thanks for the info I'm new to JSF, I usually work with JAX-RS and another partner take care of the frontend, and we decided to try with JSF for this small project – Rene Nochebuena Jul 26 '19 at 03:36

1 Answers1

4

Floating Label isn't available in 7.0 but in 7.1, see: https://github.com/primefaces/primefaces/issues/4777

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
tandraschko
  • 2,291
  • 13
  • 13