1

I couldn't see neither primefaces nor html components in my page. I can see only "sdaf" string. What can be the problem? At index.xhtml page autocomplete works good I can see component names. There must be nothing wrong with libraries.

My index.xhtml file;

<html xmlns="http://www.w3.org/1999/xhtml"  
xmlns:h="http://java.sun.com/jsf/html"  
xmlns:f="http://java.sun.com/jsf/core"  
xmlns:p="http://primefaces.org/ui">  

<h:head>  

</h:head>  

<h:body>  
  <h:button value="html button"> </h:button>
  sdaf
    <p:spinner />  

</h:body>  
</html> 

my 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>5454</groupId>
<artifactId>45454</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>45454 Maven Webapp</name>
<url>http://maven.apache.org</url>

<repositories>
 <repository>  
  <id>prime-repo</id>  
 <name>PrimeFaces Maven Repository</name>  
<url>http://repository.primefaces.org</url>  
<layout>default</layout>  
</repository>  
 </repositories>

<dependencies>
<dependency>  
  <groupId>org.primefaces</groupId>  
<artifactId>primefaces</artifactId>  
  <version>3.5</version>  
</dependency> 

   <dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1</version>
  </dependency>


<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>3.8.1</version>
  <scope>test</scope>
  </dependency>
</dependencies>
<build>
  <finalName>45454</finalName>
</build>
 </project>

enter image description here

enter image description here

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
hellzone
  • 5,393
  • 25
  • 82
  • 148
  • Are you asking that you need to see the html code when right clicking your browser & view source? – Ajeesh Sep 29 '13 at 16:21
  • @Ajeesh I edited my topic. When I run my project, I can't see button and slider in page. There is only text. – hellzone Sep 29 '13 at 16:24

4 Answers4

1

Try this code to see whether you can see inputtext box and a command button,

 <html xmlns="http://www.w3.org/1999/xhtml"  
 xmlns:h="http://java.sun.com/jsf/html"  
xmlns:f="http://java.sun.com/jsf/core"  
 xmlns:p="http://primefaces.org/ui">  

 <f:view contentType="text/html">
    <h:head>
        <f:facet name="first">
            <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
            <title>Title Goes Here</title>
        </f:facet>
    </h:head>
    <h:body>
   <h:form>
            <p:panel header="Send">
                <p:inputText value="Hi"></p:inputText>
                <p:commandButton value="Send" id="btnDisplay"/> 
            </p:panel>

            </h:form>


    </h:body>

</f:view>
 </html>

Web.xml

You need to have the below lines in your web.xml file

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
Ajeesh
  • 1,572
  • 3
  • 19
  • 32
1

Problem could be your 'URL' if in your web.xml you have mapping:

<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
</servlet-mapping>`

then you need to add 'faces' to your url. For example:

:http://localhost:8080/ABC/faces/pages/login.xhtml
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Mohit Bhagat
  • 245
  • 5
  • 14
0

The reason is because you have not rendered the requested api like jsf-impl to your pom.xml for reference check Primefaces-Maven-Example

kark
  • 4,763
  • 6
  • 30
  • 44
0

Try to put your elements to show on page into the form tag:

<h:form>
 <h:button value="html button"> </h:button>
  sdaf
 <p:spinner/>
</h:form>
rustemk
  • 86
  • 1
  • 9