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.faces.event.ActionEvent;
32 import jakarta.inject.Named;
33
34
35 /**
36 * Backing bean for the <code>index.jsp</code> page.
37 */
38
39 @Named
40 @RequestScoped
41 public class IndexBacking extends AbstractBacking {
42
43
44 // -------------------------------------------------------- Static Variables
45
46
47 /**
48 * The {@code Log} instance for this class.
49 */
50 private final static Logger LOG =
51 LoggerFactory.getLogger(IndexBacking.class);
52
53
54 // ----------------------------------------------------------------- Actions
55
56
57 /**
58 * <p>Forward to the <em>Create Registration</em> action.</p>
59 */
60 public String create() {
61
62 LOG.debug("create()");
63 FacesContext context = FacesContext.getCurrentInstance();
64 StringBuilder sb = registration(context);
65 sb.append("?action=Create");
66 forward(context, sb.toString());
67 return (null);
68
69 }
70 /**
71 * <p>Testing actionListener call</p>
72 * @param actionEvent
73 */
74 public void testListener(ActionEvent actionEvent){
75 // System.out.println("================= it works!!");
76 }
77
78 /**
79 * <p>Forward to the <em>Logon</em> page.</p>
80 */
81 public String logon() {
82
83 LOG.debug("logon()");
84 return "logon";
85
86 }
87 }