⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 countryandcityaddaction.java

📁 eclipse java/jsp 航空管理系统
💻 JAVA
字号:
package kangyi.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import kangyi.form.CountryManagerForm;
import kangyi.model.CountryManager;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import zhangchunliang.model.AppMode;

/**
 * <p>Description  :  在有国家可选择的情况下添加城市和国家名称 </p>
 * <p>Project      :  ciqms
 * <p>Company      :  东软股份国际合作事业部</p>
 * <p>Create Date  :  2005.4.17</P>
 * @author         :  康毅 | kangyi@neusoft.com
 * @version        :  0.2
 * @see            :  kangyi.form.CountryManagerForm
 * @see            :  kangyi.model.CountryManager
 * 
 */

public class CountryAndCityAddAction extends Action{
    public ActionForward execute(ActionMapping map, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) throws Exception{
    	
		if(!AppMode.getAppMode()){
			System.out.println("Application is terminated...");
			return map.findForward("appInfo");
		}
        
        /*获得表单里的城市名称,国家名称信息*/
        String countryname=request.getParameter("countryname");
        String cityname=request.getParameter("cityname");
        /*把获得的值SET到自定义的 FORM 中去*/
        ((CountryManagerForm)form).setCountryname(countryname);
        ((CountryManagerForm)form).setCityname(cityname);
        /*事例化表单 为传递参数做准备*/
        CountryManagerForm countrymanagerform=((CountryManagerForm)form);
        /*事例化功能类*/
        CountryManager countrymanager=new CountryManager();
        /*
         * 把表单作为参数传递给FROM,返回类型为int型
         * 操作成功跳转到SUCCESS,错误跳转到FAILING
         * 
         */
        int info=countrymanager.countryAndCityAdd(countrymanagerform);
        if(info==1&&countryname!=null&&cityname!=null){
            return map.findForward("success");
        }
        else if(info==7){
            return map.findForward("failing");
        }
        return map.findForward("failing");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -