View Javadoc
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  
20  package org.apache.myfaces.tobago.example.demo;
21  
22  import org.slf4j.Logger;
23  import org.slf4j.LoggerFactory;
24  
25  import javax.enterprise.context.SessionScoped;
26  import javax.inject.Named;
27  import java.io.Serializable;
28  import java.lang.invoke.MethodHandles;
29  
30  @Named
31  @SessionScoped
32  public class ExecuteController implements Serializable {
33  
34    private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
35  
36    private String value1;
37    private String value2;
38    private String value3;
39    private String value4;
40  
41    public String clear() {
42      LOG.info("action");
43      value1=null;
44      value2=null;
45      value3=null;
46      value4=null;
47      log();
48      return "/content/40-test/50000-java/20-ajax-execute/Ajax_Execute.xhtml?faces-redirect=true";
49    }
50  
51    public String reload() {
52      LOG.info("reload");
53      log();
54      return "/content/40-test/50000-java/20-ajax-execute/Ajax_Execute.xhtml?faces-redirect=true";
55    }
56  
57    public String action() {
58      LOG.info("action");
59      log();
60      return null;
61    }
62  
63    private void log() {
64      LOG.info("value1='{}'", value1);
65      LOG.info("value2='{}'", value2);
66      LOG.info("value3='{}'", value3);
67      LOG.info("value4='{}'", value4);
68    }
69  
70    public String getValue1() {
71      return value1;
72    }
73  
74    public void setValue1(final String value1) {
75      this.value1 = value1;
76    }
77  
78    public String getValue2() {
79      return value2;
80    }
81  
82    public void setValue2(final String value2) {
83      this.value2 = value2;
84    }
85  
86    public String getValue3() {
87      return value3;
88    }
89  
90    public void setValue3(final String value3) {
91      this.value3 = value3;
92    }
93  
94    public String getValue4() {
95      return value4;
96    }
97  
98    public void setValue4(final String value4) {
99      this.value4 = value4;
100   }
101 }