[
http://jira.jboss.com/jira/browse/RF-2319?page=comments#action_12401945 ]
Andreas Chlupacek commented on RF-2319:
---------------------------------------
Thank you for commenting. Granted, a4j commandLink and commandButton do work - but we need
to use the "plain vanilla" versions, which do not invoke their JSF actions even
with the changes in jboss-portlet.xml and web.xml proposed above.
We need to have a full page refresh without having to specify a reRender attribute. And,
what's more important: since the a4j components generate AJAX requests, we would be
getting problems trying to obtain the portlet's ActionRequest in our JSF Action. With
h:commandLink / h:commandButton, the following code will give you a JBossActionRequest:
ActionRequest req =
(ActionRequest)(FacesContext.getCurrentInstance().getExternalContext().getRequest());
If you use the a4j counterparts, you'll get a ClassCastException, since
getExternalContext().getRequest() will give you a
org.apache.catalina.connector.RequestFacade instead.
Regards,
Andreas
h:commandLink and h:commandButton not working with RichFaces Portlet
Bridge 3.1.4-GA / 3.1.4-SR1 in portlet/facelet environment
-------------------------------------------------------------------------------------------------------------------------------
Key: RF-2319
URL:
http://jira.jboss.com/jira/browse/RF-2319
Project: RichFaces
Issue Type: Bug
Affects Versions: 3.1.4
Environment: JBoss Portal 2.6.3-GA / JBoss [Trinity] 4.2.2.GA (build:
SVNTag=JBoss_4_2_2_GA date=200710221139)
Java version: 1.5.0_11,Sun Microsystems Inc.
Java VM: Java HotSpot(TM) Client VM 1.5.0_11-b03,Sun Microsystems Inc.
OS-System: Windows 2000 5.0,x86
Reporter: Andreas Chlupacek
Assigned To: Alexander Smirnov
Fix For: 3.2.0
This might be a problem related to JIRA entry RF-2180, however we did not experience any
view expired exception or JavaScript Errors described there. Furthermore, it seems to be
related solely to the Portlet Bridge.
Description:
==========
A JSR-168 portlet project using RichFaces 3.1.3-GA and facelets was deployed on JBoss
Portal 2.6.3. After upgrading the RichFaces Portlet Bridge libraries contained in the
project to 3.1.4-GA, h:commandButton and h:commandLink components do not invoke the
actions bound to them anymore. Upgrading to Portlet Bridge 3.1.4-SR1 does not remedy the
problem either.
Steps to reproduce:
================
Set up a portlet application with the following artefacts:
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.COMPRESS_STYLE</param-name>
<param-value>false</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>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
<param-value>rfRes</param-value>
</context-param>
<!-- This is optional parameters for a facelets based application -->
<context-param>
<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
<param-value>
org.ajax4jsf.portlet.application.FaceletPortletViewHandler
</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>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.VIEW_MAPPINGS</param-name>
<param-value>*.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<filter>
<display-name>Ajax4jsf Filter</display-name>
<filter-name>ajax4jsf</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>ajax4jsf</filter-name>
<servlet-name>FacesServlet</servlet-name>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>svg</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>
faces-config.xml:
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces
Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<managed-bean>
<managed-bean-name>bean</managed-bean-name>
<managed-bean-class>de.tmobile.richfaces.test.Bean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<!-- Richfaces configuration -->
<application>
<view-handler>org.ajax4jsf.portlet.application.PortletViewHandler</view-handler>
<state-manager>org.ajax4jsf.portlet.application.PortalStateManager</state-manager>
</application>
<factory>
<faces-context-factory>org.ajax4jsf.portlet.context.FacesContextFactoryImpl</faces-context-factory>
</factory>
</faces-config>
jboss-portlet.xml:
<?xml version="1.0"?>
<!DOCTYPE portlet-app PUBLIC
"-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
"http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
<portlet-app>
<portlet>
<portlet-name>richFacesPortlet</portlet-name>
<header-content>
<script src="/faces/rfRes/org/ajax4jsf/framework.pack.js"
type="text/javascript" ></script>
<script src="/faces/rfRes/org/richfaces/ui.pack.js"
type="text/javascript" ></script>
<link rel="stylesheet" type="text/css"
href="/faces/rfRes/org/richfaces/skin.xcss" />
</header-content>
</portlet>
</portlet-app>
view.xhtml:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<a4j:portlet
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:outputText value="RichFaces components in the portal environment" />
<h:form>
<h:panelGrid columns="1" border="1">
<h:inputText value="#{bean.text}">
<a4j:support event="onkeyup" reRender="text,input" />
</h:inputText>
<h:outputText id="text" value="#{bean.text}" />
<h:commandButton action="#{bean.click}"
value="Click"></h:commandButton>
<h:outputText id="counter" value="Click count: #{bean.counter}"
/>
</h:panelGrid>
</h:form>
</a4j:portlet>
Contents of /WEB-INF/lib:
commons-beanutils-1.7.0.jar
commons-collections-3.2.jar
commons-digester-1.8.jar
jsf-facelets.jar
portletbridge-api-3.1.3.GA.jar
portletbridge-impl-3.1.3.GA.jar
richfaces-api-3.1.3.GA.jar
richfaces-impl-3.1.3.GA.jar
richfaces-ui-3.1.3.GA.jar
Observed behaviour:
===================
After upgrading the portletbridge jars to any version of 3.1.4, the action is not
invoked. PhaseTracker shows that Stage 1 (Restore View) of the JSF lifecycle is executed
and processing then directy advances to stage 6 (Render Response).
Expected behaviour:
===================
The action should be invoked.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira