【发布时间】:2015-06-01 16:44:45
【问题描述】:
我正在尝试在 primefaces 上工作。当我尝试在我的 Eclipse IDE 中单独运行 xhtml 页面时,“index.xhtml”中包含的所有 primeface 元素都可以正常工作,但是当我更新“web.xml”以将“index.xhtml”设置为主页时并整体执行项目元素没有正确呈现我的代码如下所示。当我提交表单并想再次重新提交另一个条目时,问题就出现了。
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>
【问题讨论】:
-
先生。 BalusC,您标记为重复的问题与我问的问题不同。我检查了两次,看到这里我的问题是提交我的实际问题的表单后元素没有正确呈现。
标签: jsf jsf-2 primefaces