0

I would like to have a input text field for a form in JSF 2.3.1 (with J2E) but I have nothing on my page, only the text H1 ...

I searched on other posts, they said because the alias should be com.sun but I don't know how to change it :(

Every comments are welcomed :)

Edit: I can't see h:commandButton neither

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head>
        <title>First Project JSF 2.3</title>
    </h:head>
    <h:body>
     <h1>First Project JSF 2.3 - hello.xhtml</h1>
     <h:form>
        <h:inputText value="#{helloBean.name}" />
     </h:form>
    </h:body>
</html>

The pom.xml file

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.primagaz</groupId>
  <artifactId>ProjectTest</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
   <dependencies>
        <!-- Servlet provided by tomcat -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>

        <!-- JSF -->
        <!-- https://mvnrepository.com/artifact/org.apache.myfaces.core/myfaces-api -->
        <dependency>
            <groupId>org.apache.myfaces.core</groupId>
            <artifactId>myfaces-api</artifactId>
            <version>2.3.1</version>
        </dependency>

        <!-- PrimeFaces -->
        <!-- https://mvnrepository.com/artifact/org.primefaces/primefaces -->
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>6.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.jboss.weld.servlet/weld-servlet-core -->
        <dependency>
            <groupId>org.jboss.weld.servlet</groupId>
            <artifactId>weld-servlet-core</artifactId>
            <version>3.0.4.Final</version>
        </dependency>
        
        <dependency>
      <groupId>jstl</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
  </dependency>
        
     <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
     </dependency>
  </dependencies>
  
  
</project>
Kukeltje
  • 12,223
  • 4
  • 24
  • 47
FabRoussel
  • 190
  • 1
  • 1
  • 15
  • Did you check the source of the page client-side? – Kukeltje Jul 09 '18 at 18:23
  • 1
    Possible duplicate of [How to properly install and configure JSF libraries via Maven?](https://stackoverflow.com/questions/8081234/how-to-properly-install-and-configure-jsf-libraries-via-maven) – Kukeltje Jul 09 '18 at 18:25
  • 1
    Kukeltje's link is pretty relevant for your question. Additionally, you may have a look at [JSF namespace changes](https://jsflive.wordpress.com/2013/05/16/jsf22-namespaces/): instead of `xmlns:h="http://java.sun.com/jsf/html"`, you will need `xmlns:h="http://xmlns.jcp.org/jsf/html"` – Al-un Jul 10 '18 at 04:31
  • And if you tag it jsf-2.3 (and put 2.3.1 in the title), you sort of state it works in 2.2.x. Tags are for where problems are, not what you use. And java-ee is way to broad – Kukeltje Jul 10 '18 at 06:30
  • I think you are right about the error, because if I try any JSF tag it does not work either. I updated the link but I obtain the same result... I will explore that track a little deeper and come back – FabRoussel Jul 10 '18 at 07:32
  • If you use a plain servlet container like Tomcat or Jetty, you must also add the MyFaces "impl" module, not just the "api" module. – tandraschko Jul 10 '18 at 08:14

0 Answers0