View Javadoc

    1   /*
    2    * $Id: IndexBacking.java 471754 2006-11-06 14:55:09Z husted $
    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 javax.faces.context.FacesContext;
    27  import javax.faces.event.ActionEvent;
    28
    29  import org.apache.commons.logging.Log;
    30  import org.apache.commons.logging.LogFactory;
    31
    32
    33  /**
    34   * <p>Backing bean for the <code>index.jsp</code> page.</p>
    35   */
    36
    37  public class IndexBacking extends AbstractBacking {
    38
    39
    40      // -------------------------------------------------------- Static Variables
    41
    42
    43      private static final Log log = LogFactory.getLog(IndexBacking.class);
    44
    45
    46      // ----------------------------------------------------------------- Actions
    47
    48
    49      /**
    50       * <p>Forward to the <em>Create Registration</em> action.</p>
    51       */
    52      public String create() {
    53
    54          if (log.isDebugEnabled()) {
    55              log.debug("create()");
    56          }
    57          FacesContext context = FacesContext.getCurrentInstance();
    58          StringBuffer sb = registration(context);
    59          sb.append("?action=Create");
    60          forward(context, sb.toString());
    61          return (null);
    62
    63      }
    64      /**
    65       * <p>Testing actionListener call</p>
    66       * @param actionEvent
    67       */
    68      public void testListener(ActionEvent actionEvent){
    69  //      System.out.println("================= it works!!");
    70      }
    71
    72      /**
    73       * <p>Forward to the <em>Logon</em> page.</p>
    74       */
    75      public String logon() {
    76
    77          if (log.isDebugEnabled()) {
    78              log.debug("logon()");
    79          }
    80          return "logon";
    81
    82      }
    83
    84
    85  }