01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.myfaces.blank;
20:
21: import org.apache.commons.logging.Log;
22: import org.apache.commons.logging.LogFactory;
23:
24: import javax.faces.event.ActionEvent;
25: import javax.annotation.PostConstruct;
26: import javax.annotation.Resource;
27:
28: /**
29: * A typical simple backing bean, that is backed to <code>helloworld.jsp</code>
30: *
31: * @author <a href="mailto:matzew@apache.org">Matthias Weßendorf</a>
32: */
33: public class HelloWorldBacking {
34:
35: private static Log log = LogFactory.getLog(HelloWorldBacking.class);
36: //properties
37: private String name;
38: private String greeting;
39: @Resource(name="testDouble")
40: private Double testDouble;
41:
42: /**
43: * default empty constructor
44: */
45: public HelloWorldBacking() {
46: greeting = "Hello";
47: }
48:
49: @PostConstruct()
50: public void postConstruct() {
51: log.error("PostConstruct");
52: log.error("Test Double " + testDouble);
53: }
54:
55: //-------------------getter & setter
56: public String getName() {
57: return name;
58: }
59:
60: public void setName(String name) {
61: this .name = name;
62: }
63:
64: public String getGreeting() {
65: return greeting;
66: }
67:
68: public void setGreeting(String greeting) {
69: this .greeting = greeting;
70: }
71:
72: public Double getTestDouble() {
73: return testDouble;
74: }
75:
76: public void setTestDouble(Double testDouble) {
77: this .testDouble = testDouble;
78: }
79:
80: /**
81: * Method that is backed to a submit button of a form.
82: */
83: public String send() {
84: //do real logic
85: return ("success");
86: }
87:
88: public void updateGreeting(ActionEvent evt) {
89: greeting = "Bye!";
90: }
91: }
|