View Javadoc
1   /*
2    * $Id$
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  
23  package org.apache.struts.webapp.example;
24  
25  
26  import org.slf4j.Logger;
27  import org.slf4j.LoggerFactory;
28  
29  import jakarta.enterprise.context.RequestScoped;
30  import jakarta.faces.context.FacesContext;
31  import jakarta.inject.Named;
32  
33  
34  /**
35   * <p>Backing bean for the <code>mainMenu.jsp</code> page.</p>
36   */
37  
38  @Named
39  @RequestScoped
40  public class MainMenuBacking extends AbstractBacking {
41  
42  
43      // -------------------------------------------------------- Static Variables
44  
45  
46      /**
47       * The {@code Log} instance for this class.
48       */
49      private final static Logger LOG =
50          LoggerFactory.getLogger(MainMenuBacking.class);
51  
52  
53      // ----------------------------------------------------------------- Actions
54  
55  
56      /**
57       * <p>Forward to the <em>Edit Registration</em> action.</p>
58       */
59      public String edit() {
60  
61          LOG.debug("edit()");
62          FacesContext context = FacesContext.getCurrentInstance();
63          StringBuilder sb = registration(context);
64          sb.append("?action=Edit");
65          forward(context, sb.toString());
66          return (null);
67  
68      }
69  
70  
71      /**
72       * <p>Forward to the <em>Logoff</em> action.</p>
73       */
74      public String logoff() {
75  
76          LOG.debug("logoff()");
77          FacesContext context = FacesContext.getCurrentInstance();
78          forward(context, logoff(context).toString());
79          return (null);
80  
81      }
82  }