-1

I'm trying to work on primefaces. when i am trying to run a xhtml page individually in my eclipse IDE, All the primeface elements included in my "index.xhtml" works fine, But when i updated my "web.xml" to set "index.xhtml" as a homepage and execute project on a whole the elements are not rendering properly my code is written as below. and the problem is arising when i submitted the form and want to again re-submit another entry.

index.xhtml

   <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"   
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"`enter code here`
       xmlns:p="http://primefaces.org/ui">
    <h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Visitor Information</title>
    </h:head>
    <h:body>
    <h1 align="center">Visitor information</h1>
    <p:outputLabel>
     Name:
    </p:outputLabel><p:inputText />
        form-Element 1
        form-Element 2
        form-Element 3
        form-Date element 1
        form-Data element 2
    </h:body>
    </html>

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_3_1.xsd" version="3.1">
  <display-name>jsfwebapp</display-name>
  <welcome-file-list>
  <welcome-file>index.xhtml</welcome-file>
  </welcome-file-list>
  <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>/faces/*</url-pattern>
  </servlet-mapping>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
</web-app>
Sampath
  • 403
  • 6
  • 17
  • Mr. BalusC the the questions you marked as duplicate is not the same question i asked. i checked it twice, see here my problem is the elements are not rendering properly after submitting the form that is my actual question. – Sampath Jul 16 '15 at 06:30

2 Answers2

1

I finally fixed the problem, the form is actually loading perfectly for the first time , and when i submit the values and try to re-submit another record for the second time few elements are not loading,

i first realized that the problem is with the primefaces but the actual problem is this , when the form values are initialized through a setter and submitted to the back-end, they are not actually cleared after the submission , so all the values of the past record are again reloaded to the form through the getter method. the form contains prime-face date elements, as they are trying to load the date-element with previous record which is yielding me an error,and elements are not loading due to the error with the date-element.

the solution i did is clearing off the form values once they get submitted to the back-end database.

Sampath
  • 403
  • 6
  • 17
0

Try:

<welcome-file-list>
    <welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>

The index.xhtml page should use the Faces-Servlet.

Tomek
  • 494
  • 2
  • 11
  • Why the elements do not render all the time ? because when i run the element for the first time im able to get all the elements when i execute the same code second time i see some elements are missing ? is there any specific reason for this ? – Sampath Jun 01 '15 at 17:12
  • the code works for few elemts when i designed complete form it dosen't show up anything again – Sampath Jun 01 '15 at 17:23