Guest User

Untitled

a guest
Apr 1st, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml"
  3. xmlns:h="http://java.sun.com/jsf/html"
  4. xmlns:f="http://java.sun.com/jsf/core"
  5. xmlns:p="http://primefaces.org/ui"
  6. xmlns:pm="http://primefaces.org/mobile">
  7.  
  8. <f:view renderKitId="PRIMEFACES_MOBILE"/>
  9.  
  10. <h:head>
  11.  
  12. </h:head>
  13.  
  14. <h:body>
  15.  
  16. <pm:page>
  17. <pm:header title="Test"></pm:header>
  18.  
  19. <pm:content>
  20. <p:panel header="Login">
  21. <h:form>
  22. <pm:field>
  23. <p:outputLabel for="basic" value="User:"/>
  24. <p:inputText id="basic"/>
  25. </pm:field>
  26.  
  27. <pm:field>
  28. <p:outputLabel for="password" value="Password:"/>
  29. <p:password id="password"/>
  30. </pm:field>
  31.  
  32. <p:commandButton value="Login" type="button"
  33. actionListener="#{index.loginButtonAction}"/>
  34. </h:form>
  35. </p:panel>
  36. </pm:content>
  37. </pm:page>
  38. </h:body>
  39.  
  40. </html>
  41.  
  42. import javax.faces.application.FacesMessage;
  43. import javax.faces.bean.ManagedBean;
  44. import javax.faces.bean.RequestScoped;
  45. import javax.faces.context.FacesContext;
  46. import javax.faces.event.ActionEvent;
  47.  
  48. @ManagedBean(name = "index")
  49. @RequestScoped
  50. public class IndexView {
  51. public void loginButtonAction(ActionEvent actionEvent)
  52. {
  53. System.out.println("loginButtonAction");
  54. addMessage("loginButtonAction");
  55. }
  56.  
  57. public void registerButtonAction(ActionEvent actionEvent)
  58. {
  59. System.out.println("registerButtonAction");
  60. addMessage("registerButtonAction");
  61. }
  62.  
  63. public void addMessage(String summary) {
  64. FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, summary, null);
  65. FacesContext.getCurrentInstance().addMessage(null, message);
  66. }
  67. }
  68.  
  69. <dependencies>
  70. <dependency>
  71. <groupId>junit</groupId>
  72. <artifactId>junit</artifactId>
  73. <version>4.1</version>
  74. <scope>test</scope>
  75. </dependency>
  76.  
  77. <!-- PrimeFaces (start) -->
  78. <dependency>
  79. <groupId>org.primefaces</groupId>
  80. <artifactId>primefaces</artifactId>
  81. <version>5.1</version>
  82. </dependency>
  83. <!-- PrimeFaces (end) -->
  84.  
  85. <!-- JSF 2 (start) -->
  86. <dependency>
  87. <groupId>com.sun.faces</groupId>
  88. <artifactId>jsf-api</artifactId>
  89. <version>2.1.11</version>
  90. </dependency>
  91. <dependency>
  92. <groupId>com.sun.faces</groupId>
  93. <artifactId>jsf-impl</artifactId>
  94. <version>2.1.11</version>
  95. </dependency>
  96.  
  97. <dependency>
  98. <groupId>javax.servlet</groupId>
  99. <artifactId>jstl</artifactId>
  100. <version>1.2</version>
  101. </dependency>
  102.  
  103. <dependency>
  104. <groupId>javax.servlet</groupId>
  105. <artifactId>servlet-api</artifactId>
  106. <version>2.5</version>
  107. </dependency>
  108.  
  109. <dependency>
  110. <groupId>javax.servlet.jsp</groupId>
  111. <artifactId>jsp-api</artifactId>
  112. <version>2.1</version>
  113. </dependency>
  114. <!-- JSF 2 (end) -->
  115. </dependencies>
  116.  
  117. type="button"
Add Comment
Please, Sign In to add comment