1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
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.view.facelets.bean;
20
21 import javax.faces.component.UIComponent;
22 import javax.faces.context.FacesContext;
23 import javax.faces.event.AbortProcessingException;
24 import javax.faces.event.ActionEvent;
25 import javax.faces.event.ActionListener;
26 import javax.faces.event.ValueChangeEvent;
27
28 /**
29 * A typical simple backing bean, that is backed to <code>helloworld.jsp</code>
30 *
31 */
32 public class HelloWorld {
33
34
35 //properties
36 private String name;
37
38 /**
39 * default empty constructor
40 */
41 public HelloWorld(){
42 }
43
44 //-------------------getter & setter
45 public String getName() {
46 return name;
47 }
48 public void setName(String name) {
49 this.name = name;
50 }
51
52 /**
53 * Method that is backed to a submit button of a form.
54 */
55 public String send(){
56 //do real logic, return a string which will be used for the navigation system of JSF
57 return "success";
58 }
59
60 public void doSomething(ActionEvent evt)
61 {
62
63 }
64
65 public void validateName(FacesContext context, UIComponent toValidate,
66 Object value)
67 {
68
69 }
70
71 public void afterValueChange(ValueChangeEvent evt)
72 {
73
74 }
75
76 private ActionListener _actionListener;
77
78 public ActionListener getActionListener()
79 {
80 if (_actionListener == null)
81 {
82 _actionListener = new ActionListener()
83 {
84
85 public void processAction(ActionEvent actionEvent)
86 throws AbortProcessingException
87 {
88
89 }
90 };
91 }
92 return _actionListener;
93 }
94 }