Advertisement
Guest User

Untitled

a guest
Apr 15th, 2014
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. @ComponentScan()
  2. @EnableAutoConfiguration
  3. public class Application {
  4.  
  5. public static void main(String[] args) {
  6. SpringApplication app = new SpringApplication(Application.class);
  7. app.setShowBanner(false);
  8. app.run(args);
  9. }
  10.  
  11. @Bean
  12. public ServletRegistrationBean servletRegistrationBean() {
  13. FacesServlet servlet = new javax.faces.webapp.FacesServlet();
  14. return new ServletRegistrationBean(servlet, "/faces/*");
  15. }
  16. }
  17.  
  18. <?xml version="1.0" encoding="UTF-8"?>
  19. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  20. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  21. <html xmlns="http://www.w3.org/1999/xhtml"
  22. xmlns:h="http://java.sun.com/jsf/html"
  23. xmlns:f="http://java.sun.com/jsf/core"
  24. xmlns:ui="http://java.sun.com/jsf/facelets"
  25. xmlns:p="http://primefaces.org/ui">
  26.  
  27. <h:head>
  28. </h:head>
  29. <h:body>
  30. <h1>Hello World</h1>
  31.  
  32. <h:form>
  33. <p><h:outputText value="#{userView.value}"/></p>
  34. </h:form>
  35.  
  36. </h:body>
  37. </html>
  38.  
  39. @ViewScoped
  40. @ManagedBean(name = "userView")
  41. public class UserView {
  42.  
  43. private String value = "This editor is provided by PrimeFaces";
  44.  
  45. public UserView() {
  46. super();
  47. System.out.println("userView");
  48. }
  49.  
  50. @PostConstruct
  51. public void init() {
  52. System.out.println("---------");
  53. }
  54.  
  55. public String getValue() {
  56. return value;
  57. }
  58.  
  59. public void setValue(String value) {
  60. this.value = value;
  61. }
  62.  
  63. }
  64.  
  65. <?xml version="1.0" encoding="UTF-8"?>
  66. <faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  67. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  68. xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
  69. version="2.2">
  70. <application>
  71. <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
  72. </application>
  73. </faces-config>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement