`

Richfaces 控件使用

阅读更多
RichFace标签学习笔记
rich:componentControl 标签和rich:ModolPanel标签
示例:
<rich:modalPanel id="panel" width="350" height="100">
        <f:facet name="header">
            <h:panelGroup>
                <h:outputText value="Modal Panel"></h:outputText>
            </h:panelGroup>
        </f:facet>
        <f:facet name="controls">
            <h:panelGroup>
                <h:graphicImage value="/images/modal/close.png" style="cursor:pointer" id="hidelink"/>
                <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
</h:panelGroup>
        </f:facet>
        <h:outputText value="This panel is called using Component Control Component"></h:outputText>
        <br/>
        <h:outputText value="Closure link (X) works also through Component Control"></h:outputText>
    </rich:modalPanel>
    <h:outputLink value="#" id="link">
        Show Modal Panel
        <rich:componentControl for="panel" attachTo="link" operation="show" event="onclick"/>
</h:outputLink>
ModolPanel效果:当点击页面中的某元素时,弹出一个类似关机效果的面板。

inputNumberSlider 输入数字滑竿
Panel:
带标题栏的panel
它可以通过h:fecter标签指定标题和底部。

PanelBar:
效果说明:该控件可以实现多个面板的折叠效果,在每个面板的数据区域可以放入任何JSF标签。并且面板的标题可以设定。

<rich:panelBar height="400" width="500">
        <rich:panelBarItem
            label="Write your own custom rich components with built-in AJAX support">
            Component Development Kit (CDK) is a design-time extension for Ajax4jsf. The CDK includes
        </rich:panelBarItem>
        <rich:panelBarItem
            label="Package resources with the application's Java classes ">
            In addition to its core, Ajax functionality of Ajax4jsf provides an advanced
            support for the diff
        </rich:panelBarItem>
        <rich:panelBarItem label="Easily generate images on-the-fly">
            Resource framework can generate images on-the-fly so that it becomes possible
            to create images using the familiar approach of the Java graphic2D library.
        </rich:panelBarItem>
          </rich:panelBar>


 
PanelMenu标签:

<h:panelGrid columns="2" columnClasses="cols" width="100%">
    <rich:panelMenu style="width:200px"  mode="ajax"
        iconExpandedGroup="disc" iconCollapsedGroup="disc"
        iconExpandedTopGroup="chevronUp" iconGroupTopPosition="right"
        iconCollapsedTopGroup="chevronDown" iconCollapsedTopPosition="right" >
        <rich:panelMenuGroup label="Group 1">
            <rich:panelMenuItem label="Item 1.1" action="#{panelMenu.updateCurrent}">
                <f:param name="current" value="Item 1.1"/>
            </rich:panelMenuItem>
            <rich:panelMenuItem label="Item 1.2" action="#{panelMenu.updateCurrent}">
                <f:param name="current" value="Item 1.2"/>
            </rich:panelMenuItem>
            <rich:panelMenuItem label="Item 1.3" action="#{panelMenu.updateCurrent}">
                <f:param name="current" value="Item 1.3"/>
            </rich:panelMenuItem>
        </rich:panelMenuGroup>
        <rich:panelMenuGroup label="Group 2">
            <rich:panelMenuItem label="Item 2.1" action="#{panelMenu.updateCurrent}">
                <f:param name="current" value="Item 2.1"/>
            </rich:panelMenuItem>
            <rich:panelMenuItem   label="Item 2.2" action="#{panelMenu.updateCurrent}">
                <f:param name="current" value="Item 2.2"/>
            </rich:panelMenuItem>
            <rich:panelMenuItem label="Item 2.3" action="#{panelMenu.updateCurrent}">
                <f:param name="current" value="Item 2.3"/>
            </rich:panelMenuItem>
            <rich:panelMenuGroup label="Group 2.4">
                <rich:panelMenuItem label="Item 2.4.1" action="#{panelMenu.updateCurrent}">
                    <f:param name="current" value="Item 2.4.1"/>
                </rich:panelMenuItem>
                <rich:panelMenuItem label="Item 2.4.2" action="#{panelMenu.updateCurrent}">
                    <f:param name="current" value="Item 2.4.2"/>
                </rich:panelMenuItem>
                <rich:panelMenuItem label="Item 2.4.3" action="#{panelMenu.updateCurrent}">
                    <f:param name="current" value="Item 2.4.3"/>
                </rich:panelMenuItem>
            </rich:panelMenuGroup>
            <rich:panelMenuItem label="Item 2.5" action="#{panelMenu.updateCurrent}">
                    <f:param name="current" value="Item 2.5"/>
            </rich:panelMenuItem>
        </rich:panelMenuGroup>
        <rich:panelMenuGroup label="Group 3">
            <rich:panelMenuItem label="Item 3.1" action="#{panelMenu.updateCurrent}">
                    <f:param name="current" value="Item 3.1"/>
            </rich:panelMenuItem>
            <rich:panelMenuItem label="Item 3.2" action="#{panelMenu.updateCurrent}">
                    <f:param name="current" value="Item 3.2"/>
            </rich:panelMenuItem>
            <rich:panelMenuItem label="Item 3.3" action="#{panelMenu.updateCurrent}">
                    <f:param name="current" value="Item 3.3"/>
            </rich:panelMenuItem>
        </rich:panelMenuGroup>
    </rich:panelMenu>
    <rich:panel bodyClass="rich-laguna-panel-no-header">
        <a4j:outputPanel ajaxRendered="true">
            <h:outputText value="#{panelMenu.current} selected" id="current"/>
        </a4j:outputPanel>
    </rich:panel>
    </h:panelGrid>


progressBar标签 :

    <h:form>
        <a4j:outputPanel id="progressPanel">
            <rich:progressBar value="#{progressBarBean.currentValue}"
                interval="2000" label="#{progressBarBean.currentValue} %"
                enabled="#{progressBarBean.enabled}" minValue="-1" maxValue="100"
                reRenderAfterComplete="progressPanel">
                <f:facet name="initial">
                    <br />
                    <h:outputText value="Process doesn't started yet" />
                    <a4j:commandButton action="#{progressBarBean.startProcess}"
                        value="Start Process" reRender="progressPanel"
                        rendered="#{progressBarBean.buttonRendered}"
                        style="margin: 9px 0px 5px;" />
                </f:facet>
                <f:facet name="complete">
                    <br />
                    <h:outputText value="Process Done" />
                    <a4j:commandButton action="#{progressBarBean.startProcess}"
                        value="Restart Process" reRender="progressPanel"
                        rendered="#{progressBarBean.buttonRendered}"
                        style="margin: 9px 0px 5px;" />
                </f:facet>
            </rich:progressBar>
        </a4j:outputPanel>
    </h:form>
Separator标签:

    <p>This is default separator:</p>
    <rich:separator/>
    <p>This is tick 75% beveled separator aligned to the center:</p>
    <rich:separator lineType="beveled" height="8" width="75%" align="center"/>
    <p>Here is more examples of different line types:</p>
    <rich:separator height="2" lineType="dotted"/><br/>
    <rich:separator height="2" lineType="dashed"/><br/>
    <rich:separator height="4" lineType="double"/><br/>
    <rich:separator height="2" lineType="solid"/><br/>
simpleTogglePanel 标签:

    <rich:simpleTogglePanel switchType="client" label="Add AJAX capability to existing JSF applications">
        The framework is implemented by using a component library. The library
        set Ajax functionality into existing pages, so there is no need to write
        any JavaScript code or to replace existing components with new Ajax one.
        Ajax4jsf enables page-wide Ajax support instead of the traditional
        component-wide support and it gives the opportunity to define the event
        on the page. An event invokes an Ajax request and areas of the page
        which are synchronized with the JSF Component Tree after changing the
        data on the server by Ajax request in accordance with events fired on
        the client.            
    </rich:simpleTogglePanel>  
解释:点击该panel的标题栏将隐藏、显示内容部分。其中的switchType为client将无刷新的隐藏显示内容部分。该控件的标题栏不能添加图片,样式不可以自己设定。

tablePanel标签:

    <rich:tabPanel>
        <rich:tab label="First">
            Here is tab #1
        </rich:tab>
        <rich:tab label="Second">
            Here is tab #2
        </rich:tab>
        <rich:tab label="Third">
            Here is tab #3
        </rich:tab>
    </rich:tabPanel>
    <br/><br/>
    <p>Here is an example of tab panel switched in "ajax" style. Second tab is disabled.</p>
    <rich:tabPanel switchType="ajax">
        <rich:tab label="First">
            Here is tab #1
        </rich:tab>
        <rich:tab label="Second" disabled="true">
            Here is tab #2
        </rich:tab>
        <rich:tab label="Third">
            Here is tab #3
        </rich:tab>
    </rich:tabPanel>
    <br/><br/>
    <p>Here is an example of tab panel switched completely on client.</p>
    <rich:tabPanel switchType="client">
        <rich:tab label="First">
            Here is tab #1
        </rich:tab>
        <rich:tab label="Second">
            Here is tab #2
        </rich:tab>
        <rich:tab label="Third">
            Here is tab #3
        </rich:tab>
    </rich:tabPanel>
解释:tabPanel 的switchType有server  client  ajax三种。Server会产生页面的刷新,ajax会异步的刷新,client则不会跟服务器进行交互。

Tool Bar标签:

        <style>
            .barsearch {
                height:14px;
                width:100px;
            }
            .barsearchbutton {
                border-width:1px;
                background-color:#{a4jSkin.generalBackgroundColor};
            }
        </style>
        <h:form>
        <rich:toolBar height="34" itemSeparator="line">
            <rich:toolBarGroup>
              <h:graphicImage id="edit" value="/images/icons/edit.gif" />
              <h:outputLabel value="Edit" for="edit" />
            </rich:toolBarGroup>
            <rich:toolBarGroup>                      
              <h:graphicImage id="find" value="/images/icons/find.gif" />
              <h:outputLabel value="Find" for="find" />
            </rich:toolBarGroup>
            <rich:toolBarGroup>                      
              <h:graphicImage id="filter" value="/images/icons/filter.gif" />
              <h:outputLabel value="Filter" for="filter" />
            </rich:toolBarGroup>
            <rich:toolBarGroup location="right">
                <h:inputText styleClass="barsearch" />
                <h:commandButton styleClass="barsearchbutton" onclick="return false;"  value="Search" />
            </rich:toolBarGroup>
        </rich:toolBar>
        </h:form>
ToolTip标签:

    <style>
        .tooltip {
            background-color:#{richSkin.generalBackgroundColor};
            border-width:3px;
            padding:10px;
        }
        .tooltip-text {
            width:350px;
            height:80px;
            cursor:arrow;
            border-width:2px;
            text-align:center;
            display: table-cell;
            vertical-align: middle;
        }
        .tooltipData {
            font-weight: bold;
        }
    </style>
   
    <h:panelGrid columns="2">
    <rich:panel id="sample1" styleClass="tooltip-text" bodyClass="rich-laguna-panel-no-header">
        <p>
            Here you can see <b>default client-side</b> tool-tip
        </p>
        <rich:toolTip>
            <span style="white-space:nowrap">
                This tool-tip content was <strong>pre-rendered</strong> to the page.<br/>
                The look of this tool-tip is 100% defined by skin.
            </span>
        </rich:toolTip>
    </rich:panel>
    <rich:panel id="sample2" styleClass="tooltip-text" bodyClass="rich-laguna-panel-no-header">
        <p>
            This tool-tip will <b>follow mouse</b>. Also this tool-tip has a <b>delay 0.5 sec</b>,
             so be patient!
        </p>
        <rich:toolTip followMouse="true" direction="top-right" showDelay="500" styleClass="tooltip">
            <span  style="white-space:nowrap">
                This tool-tip content also <strong>pre-rendered</strong> to the page.<br/>
                However, the look of this tool-tip is customized<br/>
                by styleClass attribute.
            </span>
        </rich:toolTip>
    </rich:panel>
    <h:form>
    <rich:panel  id="sample3" styleClass="tooltip-text" bodyClass="rich-laguna-panel-no-header">
        <p>
            This tool-tip rendered on server <b>in separate request</b>.
        </p>
        <rich:toolTip direction="top-right" mode="ajax" styleClass="tooltip" layout="block">
            <f:facet name="defaultContent">
                <strong>Wait...</strong>
            </f:facet>
            <span   style="white-space:nowrap">This tool-tip content was <strong>rendered on server</strong>
             </span>
            <h:panelGrid columns="2">
                <h:outputText   style="white-space:nowrap" value="tooltips requested:" />
                <h:outputText value="#{toolTipData.tooltipCounter}" styleClass="tooltipData" />
            </h:panelGrid>
        </rich:toolTip>
    </rich:panel>
    </h:form>
    <h:form>
    <rich:panel  id="sample4" styleClass="tooltip-text" bodyClass="rich-laguna-panel-no-header">
        <p>
            This tool-tip will be <b>activated on mouse click</b>. It also has a <b>bottom-left</b> position.
        </p>
        <rich:toolTip showEvent="onclick" direction="bottom-left" mode="ajax" styleClass="tooltip" layout="block">
            <f:facet name="defaultContent">
                <strong>Wait...</strong>
            </f:facet>
            <span   style="white-space:nowrap">This tool-tip content was <strong>rendered on server</strong><br/></span>
            <h:panelGrid columns="2">
                <h:outputText  style="white-space:nowrap" value="tooltips requested:" />
                <h:outputText value="#{toolTipData.tooltipCounter}" styleClass="tooltipData" />
            </h:panelGrid>
        </rich:toolTip>
    </rich:panel>
    </h:form>
</h:panelGrid>
Calendar标签:
右边控件绑定been层中的属性都是Calendar的一系列属性。

    <style type="text/css">
        .ecol1 { vertical-align: top; padding-right : 25px }
        .ecol2 { vertical-align: top; border-left: #ACBECE 1px solid; padding-left : 10px }
        .rich-calendar-tool-btn{
            font-family: Arial, Verdana;
        }
    </style>
    <h:form>
        <h:panelGrid id="panel" columns="2" columnClasses="ecol1, ecol2">
            <a4j:outputPanel id="calendar" layout="block">
                    <rich:calendar value="#{calendarBean.selectedDate}"
                        locale="#{calendarBean.locale}"
                        popup="#{calendarBean.popup}"
                        datePattern="#{calendarBean.pattern}"
                        showApplyButton="#{calendarBean.showApply}" cellWidth="24px" cellHeight="22px" style="width:200px"/>
            </a4j:outputPanel>
            <h:panelGrid columns="2">
                <h:outputText value="Popup Mode:" />
                <h:selectBooleanCheckbox value="#{calendarBean.popup}">
                    <a4j:support event="onclick"  reRender="calendar"/>                    
                </h:selectBooleanCheckbox>
                <h:outputText value="Apply Button:" />
                <h:selectBooleanCheckbox value="#{calendarBean.showApply}">
                    <a4j:support event="onclick"  reRender="calendar"/>                    
                </h:selectBooleanCheckbox>
                <h:outputText value="Select Locale" />
                <h:selectOneRadio value="en/US" valueChangeListener="#{calendarBean.selectLocale}">
                    <a4j:support event="onclick" reRender="calendar"/>
                    <f:selectItem itemLabel="US" itemValue="en/US"/>
                    <f:selectItem itemLabel="DE" itemValue="de/DE"/>
                    <f:selectItem itemLabel="FR" itemValue="fr/FR"/>
                    <f:selectItem itemLabel="RU" itemValue="ru/RU"/>
                </h:selectOneRadio>
                <h:outputText value="Select Date Pattern:"/>
                <h:selectOneMenu value="#{calendarBean.pattern}">
                    <a4j:support event="onchange" reRender="calendar"/>
                    <f:selectItem itemLabel="d/M/yy HH:mm" itemValue="d/M/yy HH:mm"/>
                    <f:selectItem itemLabel="dd/M/yy hh:mm a" itemValue="dd/M/yy hh:mm a"/>
                    <f:selectItem itemLabel="d/MMM/y" itemValue="d/MMM/y"/>
                    <f:selectItem itemLabel="MMM d, yyyy" itemValue="MMM d, yyyy"/>                                           
                </h:selectOneMenu>            
            </h:panelGrid> 
        </h:panelGrid>
    </h:form>  
comboBox 标签:
该控件可以实现google搜索框的效果,唯一不同的地方就是右边有一个向下的箭头。







File Upload控件:
说明:在建立的页面中发现不到该标签。

Inplace Input标签:


SuggestionBox标签:

<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">
    <h:form id="suggestionbox_form">
            <p>
                Suggestion Box will suggest you states capitals names. Comma and space could be used as suggestions separators."
            </p>
            <h:inputText value="#{capitalsBean.capital}" id="text" />
            <rich:suggestionbox id="suggestionBoxId" for="text" tokens=",["
                rules="#{suggestionBox.rules}"
                suggestionAction="#{capitalsBean.autocomplete}" var="result"
                fetchValue="#{result.name}" rows="#{suggestionBox.intRows}"
                first="#{suggestionBox.intFirst}"
                minChars="#{suggestionBox.minchars}"
                shadowOpacity="#{suggestionBox.shadowOpacity}"
                border="#{suggestionBox.border}" width="#{suggestionBox.width}"
                height="#{suggestionBox.height}"
                shadowDepth="#{suggestionBox.shadowDepth}"
                cellpadding="#{suggestionBox.cellpadding}"
                nothingLabel="No capitals found" columnClasses="center">
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="123"></h:outputText>
                    </f:facet>
                    <h:graphicImage value="#{result.stateFlag}" />
                </h:column>
                <h:column>
                    <h:outputText value="#{result.name}" />
                </h:column>
                <h:column>
                    <h:outputText value="#{result.state}" style="font-style:italic"/>
                </h:column>
            </rich:suggestionbox>
        <rich:spacer height="30px"/>
        <h:panelGrid columns="2" border="0" >
            <h:outputText value="Border" />
            <rich:inputNumberSlider minValue="1" maxValue="5"
                value="#{suggestionBox.border}">
                <a4j:support event="onchange" reRender="suggestionBoxId" />
            </rich:inputNumberSlider>
            <h:outputText value="Width" />
            <rich:inputNumberSlider minValue="150" maxValue="350" step="50"
                value="#{suggestionBox.width}">
                <a4j:support event="onchange" reRender="suggestionBoxId" />
            </rich:inputNumberSlider>
            <h:outputText value="Height" />
            <rich:inputNumberSlider minValue="100" maxValue="300" step="50"
                value="#{suggestionBox.height}">
                <a4j:support event="onchange" reRender="suggestionBoxId" />
            </rich:inputNumberSlider>
            <h:outputText value="Shadow Depth" />
            <rich:inputNumberSlider minValue="3" maxValue="6"
                value="#{suggestionBox.shadowDepth}">
                <a4j:support event="onchange" reRender="suggestionBoxId" />
            </rich:inputNumberSlider>
            <h:outputText value="Shadow Opacity" />
            <rich:inputNumberSlider minValue="1" maxValue="9"
                value="#{suggestionBox.shadowOpacity}">
                <a4j:support event="onchange" reRender="suggestionBoxId" />
            </rich:inputNumberSlider>
            <h:outputText value="Cellpadding" />
            <rich:inputNumberSlider minValue="1" maxValue="20"
                value="#{suggestionBox.cellpadding}">
                <a4j:support event="onchange" reRender="suggestionBoxId" />
            </rich:inputNumberSlider>
        </h:panelGrid>
    </h:form>
</ui:composition>




Tree标签:

Page Source:
<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>
        .col, .col2 {
            width:50%;
            vertical-align:top;
        }
    </style>
    <h:form>   
        <h:panelGrid columns="2" width="100%" columnClasses="col1,col2">
            <rich:tree style="width:300px" nodeSelectListener="#{simpleTreeBean.processSelection}"
                reRender="selectedNode" ajaxSubmitSelection="true"  switchType="client"
                value="#{simpleTreeBean.treeNode}" var="item">
            </rich:tree>
            <h:outputText escape="false" value="Selected Node: #{simpleTreeBean.nodeTitle}" id="selectedNode" />
        </h:panelGrid>
    </h:form>
</ui:composition>
Been层:
package org.richfaces.demo.tree;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.faces.FacesException;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.richfaces.component.UITree;
import org.richfaces.event.NodeSelectedEvent;
import org.richfaces.model.TreeNode;
import org.richfaces.model.TreeNodeImpl;
public class SimpleTreeBean {
    private TreeNode rootNode = null;
    private String nodeTitle;
    private static final String DATA_PATH = "/richfaces/tree/examples/simple-tree-data.properties";
    private void addNodes(String path, TreeNode node, Properties properties) {
        boolean end = false;
        int counter = 1;
        while (!end) {
            String key = path != null ? path + '.' + counter : String.valueOf(counter);
            String value = properties.getProperty(key);
            if (value != null) {
                TreeNodeImpl nodeImpl = new TreeNodeImpl();
                nodeImpl.setData(value);
                node.addChild(new Integer(counter), nodeImpl);
                addNodes(key, nodeImpl, properties);
                counter++;
            } else {
                end = true;
            }
        }
    }
    private void loadTree() {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        ExternalContext externalContext = facesContext.getExternalContext();
        InputStream dataStream = externalContext.getResourceAsStream(DATA_PATH);
        try {
            Properties properties = new Properties();
            properties.load(dataStream);
            rootNode = new TreeNodeImpl();
            addNodes(null, rootNode, properties);
        } catch (IOException e) {
            throw new FacesException(e.getMessage(), e);
        } finally {
            if (dataStream != null) {
                try {
                    dataStream.close();
                } catch (IOException e) {
                    externalContext.log(e.getMessage(), e);
                }
            }
        }
    }
    public TreeNode getTreeNode() {
        if (rootNode == null) {
            loadTree();
        }
        return rootNode;
    }
    public void processSelection(NodeSelectedEvent event) {
        UITree tree = (UITree) event.getComponent();
        nodeTitle = (String) tree.getRowData();
    }
    public String getNodeTitle() {
        return nodeTitle;
    }
    public void setNodeTitle(String nodeTitle) {
        this.nodeTitle = nodeTitle;
    }
}
数据:
1=Daniel Defo
1.1=Robinson Crusoe
1.1.1=Start In Life
1.1.2=Slavery And Escape
1.1.3=Wrecked On A Desert Island
1.1.4=First Weeks On The Island
1.1.5=Builds A House - The Journal
1.1.6=Ill And Conscience-Stricken
1.1.7=Agricultural Experience
1.1.8=Surveys His Position
1.1.9=A Boat
1.1.10=Tames Goats
1.1.11=Finds Print Of Man's Foot On The Sand
1.1.12=A Cave Retreat
1.1.13=Wreck Of A Spanish Ship
1.1.14=A Dream Realised
1.1.15=Friday's Education
1.1.16=Rescue Of Prisoners From Cannibals
1.1.17=Visit Of Mutineers
1.1.18=The Ship Recovered
1.1.19=Return To England
1.1.20=Fight Between Friday And A Bear
2=Edgar Allan Poe
2.1=Plays
2.1.1=Politian
2.2=Short stories
2.2.1=The Assignation
2.2.2=Berenice
2.2.3=The Black Cat
2.2.4=The Cask of Amontillado
2.2.5=A Descent into the Maelstrom
2.3=Poetry
2.3.1=Alone
2.3.2=An Enigma
2.3.3=Annabel Lee
2.3.4=Bridal Ballad
3=Henry Wadsworth Longfellow
3.1=The Song of Hiawatha
3.1.1=Introduction
3.1.2=I. The Peace-Pipe
3.1.3=II. The Four Winds
3.1.4=III. Hiawatha's Childhood
3.1.5=IV. Hiawatha and Mudjekeewis
3.1.6=V. Hiawatha's Fasting
3.1.7=VI. Hiawatha's Friends
3.1.8=VII. Hiawatha's Sailing
3.1.9=VIII. Hiawatha's Fishing
3.1.10=IX. Hiawatha and the Pearl-Feather
3.1.11=X. Hiawatha's Wooing
3.1.12=XI. Hiawatha's Wedding-Feast
3.1.13=XII. The Son of the Evening Star
3.1.14=XIII. Blessing the Cornfields
3.1.15=XIV. Picture-Writing
3.1.16=XV. Hiawatha's Lamentation
3.1.17=XVI. Pau-Puk-Keewis
3.1.18=XVII. The Hunting of Pau-Puk-Keewis
3.1.19=XVIII. The Death of Kwasind
3.1.20=XIX. The Ghosts
3.1.21=XX. The Famine
3.1.22=XXI. The White Man's Foot
3.1.23=XXII. Hiawatha's Departure
3.2=Poetry
3.2.1=A Psalm Of Life
3.2.2=Birds Of Passage
3.2.3=Hiawatha's Childhood
3.2.4=Hymn To The Night
AJAX Support
Action Parameter标签:
解释:parameter标签的value属性会通过assingnto属性赋值给been层中的name。

Ajax Form标签:

当单击左边的按钮时页面看不到刷新效果,当点击右边的按钮时会有刷新效果。
<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">
        .dr-pnl-b {
            padding: 25px;
        }
    </style>
    <h:panelGrid columns="2">
        <rich:panel>
            <f:facet name="header">
                <h:outputText value="Form with ajaxSubmit equals true"/>
            </f:facet>
            <a4j:form ajaxSubmit="true" reRender="name">
                <h:panelGrid>
                    <h:commandButton value="Set Local Name to John (Ajax)" action="#{userBean.nameItJohn}" />
                    <h:outputText id="name" value="Name:#{userBean.name}" />
                </h:panelGrid>
            </a4j:form>
        </rich:panel>
        <rich:panel>
            <f:facet name="header">
                <h:outputText value="Form with ajaxSubmit equals false"/>
            </f:facet>
            <a4j:form>
                <h:panelGrid>
                    <h:commandButton value="Set Both Name to Mark (non-Ajax)" action="#{userBean.nameItMark}" />
                    <h:outputText id="name" value="Name:#{userBean.name}" />
                </h:panelGrid>
            </a4j:form>
        </rich:panel>
    </h:panelGrid>
</ui:composition>








JS Function标签:
说明:当鼠标放到三个名字上时在name后会显示相应的名字。
使用说明::jsFunction的name属性绑定的是JS方法名,该方法有一个参数,该参数是通过actionparam 标签的assignTo属性传给been层的。该标签的reRender属性指定要刷新的区域。该标签要用a4j:form标签包起来。

<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">
    <table  width="400">
        <tbody>
        <tr>
            <td><span onmouseover="updateName('Alex')"  onmouseout="updateName('')">Alex</span></td>
            <td><span onmouseover="updateName('Jonh')"  onmouseout="updateName('')">Jonh</span></td>
            <td><span onmouseover="updateName('Roger')"  onmouseout="updateName('')">Roger</span></td>
        </tr>
        <rich:spacer height="10" />
        <tr>
            <td colspan="3">Name: <b><h:outputText id="showname" value="#{userBean.name}" /></b></td>
        </tr>
        </tbody>
    </table>
    <a4j:form>
        <a4j:jsFunction name="updateName" reRender="showname">
            <a4j:actionparam name="param1" assignTo="#{userBean.name}"  />                 
        </a4j:jsFunction>
    </a4j:form>
    <br />
</ui:composition>


Poll标签:
说明:该标签相当于一个计时器,会以某频率刷新页面上的指定区域。

<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">
    <a4j:region>
        <h:form>
            <a4j:poll id="poll" interval="500" enabled="#{pollBean.pollEnabled}"
                reRender="poll,grid" />
        </h:form>
    </a4j:region>
    <h:form>
        <h:panelGrid columns="2" width="80%" id="grid">
            <h:panelGrid columns="1">
                <h:outputText value="Polling Inactive" <b
分享到:
评论

相关推荐

    RichFaces 3.3 帮助文档(英文)

    - **标准控件皮肤化:** 展示了如何为RichFaces的标准控件应用皮肤。 - **客户端脚本扩展皮肤支持:** 介绍了如何使用客户端脚本来增强皮肤的效果。 - **XCSS 文件格式:** 介绍了XCSS(一种扩展CSS语法)的使用...

    jsf/RichFaces组件

    RichFaces组件简介,复合组件,日期控件,Ajax标签, 轻松实现。RichFaces组件简介,复合组件,日期控件,Ajax标签, 轻松实现。RichFaces组件简介,复合组件,日期控件,Ajax标签, 轻松实现。

    richfaces3.2用户手册的pdf版

    - **支持的JavaServer Faces实现和框架**:为了确保与JSF 的良好集成,RichFaces 需要与特定的JSF 实现和框架进行配合使用,例如Sun JSF RI 和Apache MyFaces。 - **支持的服务器**:RichFaces 3.2 可以在多种应用...

    richfaces-3.0.0

    7. **数据绑定:** RichFaces 支持 EL(表达式语言)进行数据绑定,将 UI 控件的值与后台bean的属性关联起来。 8. **国际化和本地化:** RichFaces 提供了对多种语言的支持,方便创建多语言应用。 9. **源码学习:...

    JBoss_RichFaces_3.3

    - **表单验证**:掌握如何使用RichFaces提供的验证机制确保数据的有效性。 - **国际化**:探索如何使应用程序支持多种语言和地区设置,提升用户体验。 - **自定义组件**:教授如何根据具体需求开发自定义组件,从而...

    RichFaces_3.3.3标签库手册

    《RichFaces 3.3.3 标签库手册》是针对富客户端开发的重要参考资料,主要涵盖RichFaces组件库在3.3.3版本中的各种功能标签及其使用方法。这本手册以HTML化的方式呈现,方便开发者查阅和理解,旨在为JavaServer Faces...

    jsf常用控件的使用

    本文将深入探讨JSF中的一些常见控件及其使用方法,旨在帮助开发者更好地理解和应用这些控件。 1. **输入控件**: - `h:inputText`:用于创建简单的文本输入字段,可以与Bean中的属性绑定,处理用户输入的数据。 -...

    JSF实例子richfaces官方实例

    JSF实例子 richfaces实例 包括ajax,双联菜单等,所有的JSF,richfaces控件 直接放入到jboss 5 或者 6的defaut/deploy目录下即可运行。如:http://10.213.11.91/rs/

    richfaces_reference.pdf

    ### RichFaces框架知识点详解 #### 一、简介 RichFaces是一款功能强大的开源JavaScript库与Java Server Faces (JSF) 集成的...- **标准控件**:提供了一系列常用控件及其使用方法,帮助开发者快速构建交互式界面。

    richfaces(text版)

    1. **案例一:在线购物系统**:使用 RichFaces 构建了一个具备商品浏览、加入购物车、结算等功能的在线购物网站。通过 AJAX 支持实现了购物车的实时更新,极大地提升了用户体验。 2. **案例二:企业资源管理系统**:...

    richfaces的jar包+demo

    1. **RichFaces组件库**:RichFaces提供了一整套组件,包括表格、图表、日历、数据输入控件等,这些组件可以直接在JSF页面中使用,极大地简化了开发过程并提升了用户体验。 2. **AJAX支持**:RichFaces的核心特性之...

    RichFaces3.4

    5. **JBoss Seam 支持**:JBoss Seam 是一个流行的企业级应用框架,可以与 RichFaces 配合使用,提供更高级的功能和服务。 6. **Portlet 支持**:RichFaces 也支持 Portlet 规范,可以在 Portal 应用中使用。 7. *...

    RichFaces 4 Developer Guide

    - **使用 RichFaces 项目原型**:通过 Maven 的原型功能可以快速创建带有基本依赖和配置的 RichFaces 项目。 ##### 3. 在现有 JSF 2 项目中使用 RichFaces 对于已经在使用 JSF 2 的项目来说,集成 RichFaces 相对...

    JSF控件详细说明

    除了标准JSF组件外,还有许多第三方库提供了更丰富的控件,如PrimeFaces、RichFaces和IceFaces。这些库提供了许多高级组件,如图表、日期选择器、树形结构等,极大地扩展了JSF的功能。 ### 使用JSF控件的注意事项 ...

    Richfaces 4 组件参考手册

    Richfaces 4 不仅支持传统的HTML控件,还提供了一系列高级的Ajax功能,使得开发者能够创建出高度互动且响应迅速的应用程序。 ##### 1.1 库 Richfaces 4 的核心价值在于其丰富的组件库。这些组件可以分为两大类:...

    richfaces_reference

    手册介绍了RichFaces的皮肤机制,包括为何需要皮肤支持、如何使用、示例展示、参数表格、自定义皮肤文件的创建与使用、内置皮肤功能、标准控件的皮肤化、客户端脚本扩展、XCSS文件格式和Plug-n-Skin机制,全面展示了...

    richfaces参考手册

    提供了一系列的文档、示例代码、社区论坛等资源链接,帮助开发者更好地学习和使用RichFaces。 #### 三、不同环境下的配置 **3.1 Web应用描述符参数** - **参数配置:** 在web.xml中配置与RichFaces相关的参数,如...

    ext,richfaces,seam的结合demo

    RichFaces通过Ajax和DHTML技术增强JSF组件的功能,提供了一系列高级组件,如数据网格、树形控件、拖放元素等,这些组件都具有Ajax功能,无需页面刷新即可更新页面的部分区域,极大地提升了用户体验。同时,RichFaces...

Global site tag (gtag.js) - Google Analytics