无法让向导示例在 GateIn 3.1 GA 中运行
我无法获取 Richfaces 向导示例在 GateIn 3.1 中工作。
我正在使用 JSF 1.2、Facelets 1.1.15、GateIn 3.1 GA、Richfaces 3.3.3、IE8。
我在这里重新发帖,因为我过去在 stackoverflow 上运气不错(最初发布在 JBoss 用户论坛上,但没有收到任何回复)。
我已经完全按照示例创建了文件,但是当我单击第一页上的“下一步”按钮时,不会包含下一页(显示不会更改)。
我应该补充一点,我在尝试获取此处描述的 Max Katz 模型向导示例时遇到了同样的问题: http://mkblog.exadel.com/2010/06/ richfaces-wizard-inside-modal-panel/
我在 IE8 和 Chrome 中遇到同样的问题。
注意:我还尝试将
添加到导航规则中,当我单击“下一步”按钮时,整个 portlet 将转到空白页面。
调试这个有什么帮助吗?我将 log4j 打开为 DEBUG,但没有看到任何关于问题所在的提示。
另一个区别是我们使用 Spring。
这是faces-config.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config 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-facesconfig_1_2.xsd"
version="1.2">
<application>
<view-handler>org.jboss.portletbridge.application.PortletViewHandler</view-handler>
<state-manager>org.jboss.portletbridge.application.PortletStateManager</state-manager>
</application>
<!-- SPRING INTEGRATION TO JSF -->
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
<application>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>es</supported-locale>
<supported-locale>en</supported-locale>
</locale-config>
</application>
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
<managed-bean>
<managed-bean-name>profile</managed-bean-name>
<managed-bean-class>com.Profile</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/richfaces/include/examples/wstep1.xhtml</from-view-id>
<navigation-case>
<from-outcome>next</from-outcome>
<to-view-id>/richfaces/include/examples/wstep2.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/richfaces/include/examples/wstep2.xhtml</from-view-id>
<navigation-case>
<from-outcome>previous</from-outcome>
<to-view-id>/richfaces/include/examples/wstep1.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>next</from-outcome>
<to-view-id>/richfaces/include/examples/finalStep.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/richfaces/include/examples/finalStep.xhtml</from-view-id>
<navigation-case>
<from-outcome>previous</from-outcome>
<to-view-id>/richfaces/include/examples/wstep2.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
这是spring-beans.xml
中的bean:
<bean id="profile" class="com.Profile" scope="request" >
</bean>
这是start.xhtml
(完全来自演示) :
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<style type="text/css">
.col1 { vertical-align:top; }
.col2 { vertical-align:top; width:450px; }
.wizard { width:400px; }
.wform td { vertical-align:top; }
.wfcol1 { text-align: right; white-space:nowrap;}
.wfcol2 { }
.wfcol3 { }
.s1row td { height:30px; }
.rich-message { color:red; }
.navPanel {
position:absolute;
bottom:0;
height:23px;
margin:0;
padding:2px;
}
</style>
<br/>
<h:panelGrid width="100%" columns="2" columnClasses="col1,col2">
<a4j:keepAlive beanName="profile" />
<rich:panel styleClass="wizard">
<f:facet name="header">
<h:outputText value="Using a4j:include for Wizard-like behaviour" />
</f:facet>
<h:form>
<a4j:include viewId="/richfaces/include/examples/wstep1.xhtml" />
</h:form>
</rich:panel>
</h:panelGrid>
<br/>
</ui:composition>
这里是 wstep1.xhtml
(该页面最初加载到 portlet 中):
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<div style="position:relative;height:140px">
<h:panelGrid rowClasses="s1row" columns="3" columnClasses="wfcol1,wfcol2,wfcol3">
<h:outputText value="First Name:" />
<h:inputText id="fn" value="#{profile.firstName}" label="First Name" required="true" />
<rich:message for="fn" />
<h:outputText value="Last Name:" />
<h:inputText id="ln" value="#{profile.lastName}" label="Last Name" required="true" />
<rich:message for="ln" />
<h:outputText value="Company:" />
<h:inputText id="comp" value="#{profile.company}" label="Company" required="true" />
<rich:message for="comp"/>
</h:panelGrid>
<div class="navPanel" style="width:100%;">
<a4j:commandButton style="float:right" action="next" value="Next >>"/>
</div>
</div>
</ui:composition>
这里是 portlet.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0">
<portlet>
<portlet-name>Rule Portlet</portlet-name>
<display-name>Rule Editor</display-name>
<portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
<init-param>
<name>javax.portlet.faces.defaultViewId.view</name>
<value>/start.xhtml</value>
</init-param>
<init-param>
<name>javax.portlet.faces.preserveActionParams</name>
<value>true</value>
</init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<portlet-info>
<title>Rule Editor</title>
</portlet-info>
</portlet>
</portlet-app>
这里是 web.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>Filter Portal</display-name>
<context-param>
<param-name>org.jboss.portletbridge.WRAP_SCRIPTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.portlet.faces.renderPolicy</param-name>
<param-value>ALWAYS_DELEGATE</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
<param-value>rfRes</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>false</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>10</session-timeout>
</session-config>
<!-- Spring Configuration -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<context-param>
<param-name>com.sun.faces.IS_SAVE_BINDINGS_STATE</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.RESOURCE_RESOLVER</param-name>
<param-value>com.CustomResourceResolver</param-value>
</context-param>
</web-app>
I cannot get the Richfaces wizard example to work in GateIn 3.1.
I am using JSF 1.2, Facelets 1.1.15, GateIn 3.1 GA, Richfaces 3.3.3, IE8.
I am reposting here as I have had good luck on stackoverflow in the past (originally posted on JBoss user forum but did not receive any responses).
I have created the files exactly as in the example but when I click Next button on the first page, the next page does not get included (display does not change).
I should add that I have the same problem trying to get Max Katz model wizard example described here:
http://mkblog.exadel.com/2010/06/richfaces-wizard-inside-modal-panel/
I am having same issue in IE8 and Chrome.
Note: I've also tried adding <redirect/>
to the navigation-rules and when I click Next button then entire portlet goes to a blank page.
Is there any help in debugging this? I turned up log4j to DEBUG but don't see any hints as to what is wrong.
The other difference is that we use Spring.
Here is the faces-config.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config 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-facesconfig_1_2.xsd"
version="1.2">
<application>
<view-handler>org.jboss.portletbridge.application.PortletViewHandler</view-handler>
<state-manager>org.jboss.portletbridge.application.PortletStateManager</state-manager>
</application>
<!-- SPRING INTEGRATION TO JSF -->
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
<application>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>es</supported-locale>
<supported-locale>en</supported-locale>
</locale-config>
</application>
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
<managed-bean>
<managed-bean-name>profile</managed-bean-name>
<managed-bean-class>com.Profile</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/richfaces/include/examples/wstep1.xhtml</from-view-id>
<navigation-case>
<from-outcome>next</from-outcome>
<to-view-id>/richfaces/include/examples/wstep2.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/richfaces/include/examples/wstep2.xhtml</from-view-id>
<navigation-case>
<from-outcome>previous</from-outcome>
<to-view-id>/richfaces/include/examples/wstep1.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>next</from-outcome>
<to-view-id>/richfaces/include/examples/finalStep.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/richfaces/include/examples/finalStep.xhtml</from-view-id>
<navigation-case>
<from-outcome>previous</from-outcome>
<to-view-id>/richfaces/include/examples/wstep2.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
Here is bean in spring-beans.xml
:
<bean id="profile" class="com.Profile" scope="request" >
</bean>
Here is start.xhtml
(exactly from demo):
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<style type="text/css">
.col1 { vertical-align:top; }
.col2 { vertical-align:top; width:450px; }
.wizard { width:400px; }
.wform td { vertical-align:top; }
.wfcol1 { text-align: right; white-space:nowrap;}
.wfcol2 { }
.wfcol3 { }
.s1row td { height:30px; }
.rich-message { color:red; }
.navPanel {
position:absolute;
bottom:0;
height:23px;
margin:0;
padding:2px;
}
</style>
<br/>
<h:panelGrid width="100%" columns="2" columnClasses="col1,col2">
<a4j:keepAlive beanName="profile" />
<rich:panel styleClass="wizard">
<f:facet name="header">
<h:outputText value="Using a4j:include for Wizard-like behaviour" />
</f:facet>
<h:form>
<a4j:include viewId="/richfaces/include/examples/wstep1.xhtml" />
</h:form>
</rich:panel>
</h:panelGrid>
<br/>
</ui:composition>
Here is wstep1.xhtml
(this page gets loaded in portlet initially):
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<div style="position:relative;height:140px">
<h:panelGrid rowClasses="s1row" columns="3" columnClasses="wfcol1,wfcol2,wfcol3">
<h:outputText value="First Name:" />
<h:inputText id="fn" value="#{profile.firstName}" label="First Name" required="true" />
<rich:message for="fn" />
<h:outputText value="Last Name:" />
<h:inputText id="ln" value="#{profile.lastName}" label="Last Name" required="true" />
<rich:message for="ln" />
<h:outputText value="Company:" />
<h:inputText id="comp" value="#{profile.company}" label="Company" required="true" />
<rich:message for="comp"/>
</h:panelGrid>
<div class="navPanel" style="width:100%;">
<a4j:commandButton style="float:right" action="next" value="Next >>"/>
</div>
</div>
</ui:composition>
Here is portlet.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0">
<portlet>
<portlet-name>Rule Portlet</portlet-name>
<display-name>Rule Editor</display-name>
<portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
<init-param>
<name>javax.portlet.faces.defaultViewId.view</name>
<value>/start.xhtml</value>
</init-param>
<init-param>
<name>javax.portlet.faces.preserveActionParams</name>
<value>true</value>
</init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<portlet-info>
<title>Rule Editor</title>
</portlet-info>
</portlet>
</portlet-app>
Here is web.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>Filter Portal</display-name>
<context-param>
<param-name>org.jboss.portletbridge.WRAP_SCRIPTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.portlet.faces.renderPolicy</param-name>
<param-value>ALWAYS_DELEGATE</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
<param-value>rfRes</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>false</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>10</session-timeout>
</session-config>
<!-- Spring Configuration -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<context-param>
<param-name>com.sun.faces.IS_SAVE_BINDINGS_STATE</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.RESOURCE_RESOLVER</param-name>
<param-value>com.CustomResourceResolver</param-value>
</context-param>
</web-app>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为 web.xml 中的最后三个参数可能有问题。众所周知,它们会导致 AJAX 出现问题(我也遇到过这些问题)。关于这些参数的文档很少。虽然我发现了关于他们的评论:
以及这些知识的来源:
http://code.google.com/p/java-education/source/browse/trunk/JPA-Spring-JSF/CZU-PEF-DataModelling/web-gui/src/main/webapp/ WEB-INF/web.xml?spec=svn200&r=200
所以我建议从你的 web.xml 中注释掉这一点:
希望它会有任何帮助。
I think there can be problem with three last params in your web.xml. They'r known to cause problems with AJAX (I also had these problems). There is only little documentation about these params. Although I found this comments about them:
And source of this knowledge:
http://code.google.com/p/java-education/source/browse/trunk/JPA-Spring-JSF/CZU-PEF-DataModelling/web-gui/src/main/webapp/WEB-INF/web.xml?spec=svn200&r=200
So I suggest commenting out this from your web.xml:
Hope it will be of any help.