我有一个JSF项目,我已经有一个工作正常的index.xhtml
页面。当我尝试添加另一个XHTML页面时,由于某种原因,它没有连接到我的会话范围的托管bean。我在我的新页面添加代码,但它不像我的index.xhtml
。我甚至复制并粘贴来自索引的代码,但它仍然不起作用。有什么想法吗?JSF新网站创建
下面是一些我在我的新的一页代码:
Amount: <h:inputText value="#{transactionBean.amount}" style="color: Yellow; background: Teal;"/>
Price <h:inputText value="#{transactionBean.pricePaid}" style="color: Yellow; background: Teal;"/
这里是我的web.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</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>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
请具体说明。什么“不起作用”?浏览器或server.log中的任何错误?没有呈现HTML? – 2012-03-02 20:22:03
不会有任何错误,它不显示任何东西,它不显示任何东西。只有数量和价格显示在页面上。没有输入文本或其他任何东西 – apoellitsi 2012-03-02 20:25:49
原因可能是第二页未被faces servlet处理。浏览器源代码中有什么? – 2012-03-02 20:30:12