Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html xmlns="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:head>
- </h:head>
- <h:body>
- <h:form >
- <a4j:queue name="someQueue"/>
- <h:panelGrid columns="2">
- <h:selectOneListbox value="#{colorsBean.color}">
- <f:selectItem itemValue="green" itemLabel="Green" />
- <f:selectItem itemValue="blue" itemLabel="Blue" />
- <f:selectItem itemValue="red" itemLabel="Red" />
- <f:selectItem itemValue="yellow" itemLabel="Yellow" />
- <f:selectItem itemValue="orange" itemLabel="Orange" />
- <f:selectItem itemValue="grey" itemLabel="Grey" />
- <f:selectItem itemValue="pink" itemLabel="Pink" />
- </h:selectOneListbox>
- <a4j:commandButton id="btn1" value="select"
- action="#{colorsBean.select}" render="colorPanel"/>
- <a4j:commandButton id="btn2" value="tryanother"
- action="#{colorsBean.tryanother}" >
- <a4j:attachQueue name="dddd" requestDelay="0"></a4j:attachQueue>
- </a4j:commandButton>
- <h:panelGrid id="colorPanel" bgcolor="#{colorsBean.color}">
- <h:outputText value="RichFaces" style="FONT-WEIGHT: bold; FONT-SIZE: xx-large;" />
- </h:panelGrid>
- </h:panelGrid>
- </h:form>
- <a4j:status id="stateStatus" startText="Working..."
- startStyle="background-color: #ffA500;
- font-weight:bold;
- position:absolute;
- right: 50%;
- top: 1px;
- width: 100px;" />
- </h:body>
- </html>
- public class ColorsBean {
- private String color;
- // getter and setter
- public void select() {
- try {
- Thread.sleep (5000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- System.out.println("color is:"+color+" "+ new Date());
- }
- public void tryanother() {
- System.out.println("********tryanother********" + new Date());
- }
- public String getColor() {
- return color;
- }
- public void setColor(String color) {
- this.color = color;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement