Tag Archives: JSF

Using Multiple RichFaces Portlets in the Same Page with JBoss Portlet Bridge

As noted here, there are known issues even if you set org.jboss.portletbridge.WRAP_SCRIPTS to true.

You may want to set org.jboss.portletbridge.WRAP_SCRIPTS to false (which is the default), set org.richfaces.LoadScriptStrategy to NONE and load the scripts in your pages:

<a4j:loadScript src="resource:////org/ajax4jsf/framework.pack.js" type="text/javascript" />
<a4j:loadScript src="resource:////org/richfaces/ui.pack.js" type="text/javascript" />
Advertisements

How to Add Command Buttons to Data Tables with RichFaces 3.3.x

faces-config.xml

<?xml version="1.0"?>
<faces-config version="1.2" 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">
  <managed-bean>
    <managed-bean-name>sample</managed-bean-name>
    <managed-bean-class>br.eti.fernandoribeiro.sample.SampleBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope> <!-- required as mentioned in http://java.net/jira/browse/JAVASERVERFACES-69 -->
  </managed-bean>
</faces-config>

page.xhtml

<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:ui="http://java.sun.com/jsf/facelets">
  <h:form>
    <rich:dataTable value="#{sample.itemList}" var="item">
      <rich:column>
        <f:facet name="header">
          <h:outputText value="Message" />
        </f:facet>
        <h:outputText value="#{item.msg}" />
      </rich:column>
      <rich:column>
        <f:facet name="header">
          <h:outputText value="Action" />
        </f:facet>
        <h:commandButton action="#{sample.sendMessage}" value="Say Hello">
          <f:setPropertyActionListener target="#{sampleBean.msg}" value="#{item.msg}" />
        </h:commandButton>
      </rich:column>
    </rich:dataTable>
  </h:form>
</ui:composition>

How to Set JSF Tag Attributes Dynamically

<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:a4j=" http://richfaces.org/a4j" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets">
  <a4j:outputPanel rendered="#{...}">
    <h:outputText value="First Value" />
  </a4j:outputPanel>
  <a4j:outputPanel rendered="#{!...}">
    <h:outputText value="Second Value" />
  </a4j:outputPanel>
</ui:composition>

Thanks to Sérgio for the correction to the original post.