com.m2a.struts.M2AActionServlet.java Source code

Java tutorial

Introduction

Here is the source code for com.m2a.struts.M2AActionServlet.java

Source

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: Jan 16, 2003
 * Time: 8:48:45 PM
 * To change this template use Options | File Templates.
 */
package com.m2a.struts;

import java.util.Collection;
import javax.servlet.ServletException;

import org.apache.struts.action.ActionServlet;
//import org.apache.commons.scaffold.lang.ResourceException;
import com.m2a.lang.M2AResourceException;
import com.m2a.resources.M2ADropDowns;
import com.m2a.resources.M2ATokens;

public class M2AActionServlet extends ActionServlet {

    /**
     * Initialize this servlet.  Most of the processing has been factored into
     * support methods so that you can override particular functionality at a
     * fairly granular level.
     *
     * @exception ServletException if we cannot configure ourselves correctly
     */
    public void init() throws ServletException {
        super.init();

        try {
            String appName = getServletConfig().getInitParameter("appname");
            if (appName != null) {
                M2ATokens.APPNAME = appName;
            }
            // collection to hold country code dropdown
            Collection countryCodeDD = M2ADropDowns.getCountryCodeDD();

            // collection to hold currency code dropdown
            Collection ccyCodeDD = M2ADropDowns.getCcyCodeDD();

            // collection to hold nationality code dropdown
            Collection nationalityCodeDD = M2ADropDowns.getNationalityCodeDD();

            // collection to hold purpose code dropdown
            Collection purposeCodeDD = M2ADropDowns.getPurposeCodeDD();

            // collection to hold sourceofincome code dropdown
            Collection sourceOfIncomeCodeDD = M2ADropDowns.getSourceOfIncomeCodeDD();

            // collection to hold idType code dropdown
            Collection idTypeDD = M2ADropDowns.getIdTypeDD();

            //collection to hold country code dropdown
            Collection benCountryCodeDD = M2ADropDowns.getBenCountryCodeDD();

            //collection to hold currency code dropdown
            Collection benCcyCodeDD = M2ADropDowns.getBenCcyCodeDD();

            //collection to hold country with currency code dropdown
            Collection countryCcyCodeDD = M2ADropDowns.getCountryCcyCodeDD();

            //collection to holde registration security questions
            Collection regSecQuestionsDD = M2ADropDowns.getRegSecQuestionsDD();

            getServletContext().setAttribute(M2ATokens.COUNTRY_DD, countryCodeDD);
            getServletContext().setAttribute(M2ATokens.CURRENCY_DD, ccyCodeDD);
            getServletContext().setAttribute(M2ATokens.NATIONALITY_DD, nationalityCodeDD);
            getServletContext().setAttribute(M2ATokens.PURPOSE_DD, purposeCodeDD);
            getServletContext().setAttribute(M2ATokens.SORUCEOFINCOME_DD, sourceOfIncomeCodeDD);
            getServletContext().setAttribute(M2ATokens.IDTYPE_DD, idTypeDD);
            getServletContext().setAttribute(M2ATokens.BENCOUNTRY_DD, benCountryCodeDD);
            getServletContext().setAttribute(M2ATokens.BENCURRENCY_DD, benCcyCodeDD);
            getServletContext().setAttribute(M2ATokens.COUNTRYCURRENCY_DD, countryCcyCodeDD);
            //for kuwait
            getServletContext().setAttribute(M2ATokens.REGSECQUESTIONS_DD, regSecQuestionsDD);
        } catch (M2AResourceException re) {
            throw new ServletException(re.getMessage());
        }

    }
}
/*
 *
 *    Copyright (c) 2002 Synthis Corporation.
 *    430 10th Street NW, Suite S-108, Atlanta GA 30318, U.S.A.
 *    All rights reserved.
 *
 *    This software is licensed to you free of charge under
 *    the Apache Software License, so long as this copyright
 *    statement, list of conditions, and comments,  remains
 *    in the source code.  See bottom of file for more
 *    license information.
 *
 *    This software was written to support code generation
 *    for the Apache Struts J2EE architecture by Synthis'
 *    visual application modeling tool Adalon.
 *
 *    For more information on Adalon and Struts code
 *    generation please visit http://www.synthis.com
 *
 */
/*
 * ====================================================================
 *
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2001 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution, if
 *    any, must include the following acknowlegement:
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowlegement may appear in the software itself,
 *    if and wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The Jakarta Project", "Scaffold", and "Apache Software
 *    Foundation" must not be used to endorse or promote products derived
 *    from this software without prior written permission. For written
 *    permission, please contact apache@apache.org.
 *
 * 5. Products derived from this software may not be called "Apache"
 *    nor may "Apache" appear in their names without prior written
 *    permission of the Apache Group.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 *
 */