|
| 1 | +package com.baeldung.springintegration.controllers; |
| 2 | + |
| 3 | +import java.util.ArrayList; |
| 4 | +import java.util.List; |
| 5 | + |
| 6 | +import javax.annotation.PostConstruct; |
| 7 | +import javax.el.ELContextEvent; |
| 8 | +import javax.el.ELContextListener; |
| 9 | +import javax.faces.bean.ManagedBean; |
| 10 | +import javax.faces.bean.ViewScoped; |
| 11 | + |
| 12 | +@ManagedBean(name = "helloPFBean") |
| 13 | +@ViewScoped |
| 14 | +public class HelloPFBean { |
| 15 | + |
| 16 | + private String firstName; |
| 17 | + private String lastName; |
| 18 | + |
| 19 | + private String componentSuite; |
| 20 | + |
| 21 | + private List<Technology> technologies; |
| 22 | + |
| 23 | + private String inputText; |
| 24 | + private String outputText; |
| 25 | + |
| 26 | + @PostConstruct |
| 27 | + public void init() { |
| 28 | + firstName = "Hello"; |
| 29 | + lastName = "Primefaces"; |
| 30 | + |
| 31 | + technologies = new ArrayList<Technology>(); |
| 32 | + |
| 33 | + Technology technology1 = new Technology(); |
| 34 | + technology1.setCurrentVersion("10"); |
| 35 | + technology1.setName("Java"); |
| 36 | + |
| 37 | + technologies.add(technology1); |
| 38 | + |
| 39 | + Technology technology2 = new Technology(); |
| 40 | + technology2.setCurrentVersion("5.0"); |
| 41 | + technology2.setName("Spring"); |
| 42 | + |
| 43 | + technologies.add(technology2); |
| 44 | + } |
| 45 | + |
| 46 | + public void onBlurEvent() { |
| 47 | + outputText = inputText.toUpperCase(); |
| 48 | + } |
| 49 | + |
| 50 | + public String getFirstName() { |
| 51 | + return firstName; |
| 52 | + } |
| 53 | + |
| 54 | + public void setFirstName(String firstName) { |
| 55 | + this.firstName = firstName; |
| 56 | + } |
| 57 | + |
| 58 | + public String getLastName() { |
| 59 | + return lastName; |
| 60 | + } |
| 61 | + |
| 62 | + public void setLastName(String lastName) { |
| 63 | + this.lastName = lastName; |
| 64 | + } |
| 65 | + |
| 66 | + public String getComponentSuite() { |
| 67 | + return componentSuite; |
| 68 | + } |
| 69 | + |
| 70 | + public void setComponentSuite(String componentSuite) { |
| 71 | + this.componentSuite = componentSuite; |
| 72 | + } |
| 73 | + |
| 74 | + public List<Technology> getTechnologies() { |
| 75 | + return technologies; |
| 76 | + } |
| 77 | + |
| 78 | + public void setTechnologies(List<Technology> technologies) { |
| 79 | + this.technologies = technologies; |
| 80 | + } |
| 81 | + |
| 82 | + public String getInputText() { |
| 83 | + return inputText; |
| 84 | + } |
| 85 | + |
| 86 | + public void setInputText(String inputText) { |
| 87 | + this.inputText = inputText; |
| 88 | + } |
| 89 | + |
| 90 | + public String getOutputText() { |
| 91 | + return outputText; |
| 92 | + } |
| 93 | + |
| 94 | + public void setOutputText(String outputText) { |
| 95 | + this.outputText = outputText; |
| 96 | + } |
| 97 | + |
| 98 | + public class Technology { |
| 99 | + private String name; |
| 100 | + private String currentVersion; |
| 101 | + |
| 102 | + public String getName() { |
| 103 | + return name; |
| 104 | + } |
| 105 | + |
| 106 | + public void setName(String name) { |
| 107 | + this.name = name; |
| 108 | + } |
| 109 | + |
| 110 | + public String getCurrentVersion() { |
| 111 | + return currentVersion; |
| 112 | + } |
| 113 | + |
| 114 | + public void setCurrentVersion(String currentVersion) { |
| 115 | + this.currentVersion = currentVersion; |
| 116 | + } |
| 117 | + |
| 118 | + } |
| 119 | + |
| 120 | +} |
0 commit comments