Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. <h:commandButton value="Save">
  2. <f:ajax event="click" listener="#{bean.save}"/>
  3. </h:commandButton>
  4.  
  5. public void save(){
  6. log.debug("Save executed!");
  7. }
  8.  
  9. <html xmlns="http://www.w3.org/1999/xhtml"
  10. xmlns:ui="http://java.sun.com/jsf/facelets"
  11. xmlns:f="http://java.sun.com/jsf/core"
  12. xmlns:h="http://java.sun.com/jsf/html"
  13. xmlns:c="http://java.sun.com/jstl/core">
  14. <ui:define name="body">
  15. <h:link outcome="agreementDetail.xhtml" value="EA-15558">
  16. <f:param name="serviceId" value="EA-15558" />
  17. <f:param name="site" value="NIC" />
  18. </h:link>
  19. </ui:define>
  20.  
  21. </html>
  22.  
  23. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  24. <html xmlns="http://www.w3.org/1999/xhtml"
  25. xmlns:ui="http://java.sun.com/jsf/facelets"
  26. xmlns:f="http://java.sun.com/jsf/core"
  27. xmlns:h="http://java.sun.com/jsf/html"
  28. xmlns:c="http://java.sun.com/jstl/core">
  29.  
  30. <f:view>
  31. <f:event type="preRenderView" listener="#{agreement.build}"/>
  32. </f:view>
  33. <ui:define name="body">
  34. <f:view>
  35. <h:form>
  36. <h:commandButton value="Save" action="#{agreement.save}">
  37. <f:ajax/>
  38. </h:commandButton><br/><br/>
  39. <h:dataTable value="#{agreement.licenseServerNames}" var="licenseServerName">
  40. <h:column>
  41. <h:inputText value="#{licenseServerName}"/>
  42. </h:column>
  43. </h:dataTable>
  44. </h:form>
  45. </f:view>
  46. </ui:define>
  47.  
  48.  
  49. </html>
  50.  
  51. @ManagedBean(name="agreement")
  52. @RequestScoped
  53. public class AgreementBean {
  54.  
  55. @ManagedProperty("#{param.serviceId}")
  56. private String serviceId;
  57.  
  58. @ManagedProperty("#{param.site}")
  59. private String site;
  60.  
  61. private List<String> licenseServerNames; //GETTERS AND SETTERS OMITTED TO AVOID EXCESS CODE
  62.  
  63. @PostConstruct
  64. public void build(){
  65. logger.debug("START");
  66. methodOne();
  67. logger.debug("END");
  68. }
  69.  
  70. public void save(){
  71. logger.debug("SAVE!!!!!");
  72. for(String name : licenseServerNames){
  73. logger.debug("Servername = "+name);
  74. }
  75. }
  76. }
  77.  
  78. <h:commandButton id="ajax" value="Save" action="{agreement.save}" >
  79. <f:ajax execute="@form" render="@form" />
  80. </h:commandButton>
  81. <h:outputScript rendered="#{agreement.show}">alert("save");</h:outputScript>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement