netbeans开发学习(1)

来源:互联网 发布:福富软件待遇 编辑:程序博客网 时间:2024/06/05 20:49

RichFaces 4.x Demo

a4j:commandButton

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:compositionxmlns="http://www.w3.org/1999/xhtml"xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"xmlns:ui="http://java.sun.com/jsf/facelets"xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich">
    <h:outputStylesheet>
        .outhello {
        font-weight: bold;
        }
    </h:outputStylesheet>
    <h:form>
        <h:panelGridcolumns="3">
            <h:outputTextvalue="Name:"/>
            <h:inputTextvalue="#{userBean.name}"/>
            <a4j:commandButtonvalue="Say Hello" render="out"execute="@form"/>
        </h:panelGrid>
    </h:form>
    <br/>
    <a4j:outputPanelid="out">
        <h:outputTextvalue="Hello #{userBean.name} !" rendered="#{not empty userBean.name}" styleClass="outhello"/>
    </a4j:outputPanel>
</ui:composition>

后台Bean

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.web.ManagerBean;


import javax.inject.Named;
import javax.enterprise.context.RequestScoped;


/**
 *
 * @author dell
 */
@Named(value = "userBean")
@RequestScoped
public class UserBean {


   private String name;
    public UserBean() {
    }


    public String getName() {
        return name;
    }


    public void setName(String name) {
        this.name = name;
    }
    
    
}







原创粉丝点击