Advertisement
Guest User

Untitled

a guest
May 24th, 2016
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. <html xmlns="http://www.w3.org/1999/xhtml"
  2. xmlns:h="http://java.sun.com/jsf/html"
  3. xmlns:f="http://java.sun.com/jsf/core"
  4. xmlns:ui="http://java.sun.com/jsf/facelets"
  5. xmlns:a4j="http://richfaces.org/a4j"
  6. xmlns:rich="http://richfaces.org/rich">
  7.  
  8. <h:head>
  9. </h:head>
  10. <h:body>
  11. <h:form >
  12. <a4j:queue name="someQueue"/>
  13. <h:panelGrid columns="2">
  14. <h:selectOneListbox value="#{colorsBean.color}">
  15. <f:selectItem itemValue="green" itemLabel="Green" />
  16. <f:selectItem itemValue="blue" itemLabel="Blue" />
  17. <f:selectItem itemValue="red" itemLabel="Red" />
  18. <f:selectItem itemValue="yellow" itemLabel="Yellow" />
  19. <f:selectItem itemValue="orange" itemLabel="Orange" />
  20. <f:selectItem itemValue="grey" itemLabel="Grey" />
  21. <f:selectItem itemValue="pink" itemLabel="Pink" />
  22. </h:selectOneListbox>
  23.  
  24. <a4j:commandButton id="btn1" value="select"
  25. action="#{colorsBean.select}" render="colorPanel"/>
  26. <a4j:commandButton id="btn2" value="tryanother"
  27. action="#{colorsBean.tryanother}" >
  28. <a4j:attachQueue name="dddd" requestDelay="0"></a4j:attachQueue>
  29. </a4j:commandButton>
  30. <h:panelGrid id="colorPanel" bgcolor="#{colorsBean.color}">
  31. <h:outputText value="RichFaces" style="FONT-WEIGHT: bold; FONT-SIZE: xx-large;" />
  32. </h:panelGrid>
  33. </h:panelGrid>
  34. </h:form>
  35. <a4j:status id="stateStatus" startText="Working..."
  36. startStyle="background-color: #ffA500;
  37. font-weight:bold;
  38. position:absolute;
  39. right: 50%;
  40. top: 1px;
  41. width: 100px;" />
  42. </h:body>
  43. </html>
  44.  
  45. public class ColorsBean {
  46.  
  47. private String color;
  48. // getter and setter
  49.  
  50. public void select() {
  51.  
  52. try {
  53. Thread.sleep (5000);
  54. } catch (InterruptedException e) {
  55. e.printStackTrace();
  56. }
  57. System.out.println("color is:"+color+" "+ new Date());
  58. }
  59.  
  60. public void tryanother() {
  61. System.out.println("********tryanother********" + new Date());
  62.  
  63. }
  64.  
  65. public String getColor() {
  66. return color;
  67. }
  68.  
  69. public void setColor(String color) {
  70. this.color = color;
  71. }
  72.  
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement