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

📄 displayallaction.java

📁 eclipse java/jsp 航空管理系统
💻 JAVA
字号:
/*
 * Copyright Neusoft Dalian Center,All Rights Reserved
 *
 * WEB Application Apply Struts Platform
 * 
 * PackageName shengjb.form
 * ClassName DisplayallAction.java
 *
 * @author shengjb  | shengjb@neusoft.com
 *
 * Created on 2005-4-18
 *
 */

package shengjb.action;

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

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 shengjb.model.DisplayAllBean;
import zhangchunliang.model.AppMode;

/**
 * DisplayallAction ActionClass
 * 
 * @author shengjb ver.0.7
 */
public class DisplayAllAction extends Action{
	
	/**
	 * Process the specified HTTP request, and create the corresponding HTTP
	 * response (or forward to another web component that will create it), with
	 * provision for handling exceptions thrown by the business logic. Return an
	 * {@link ActionForward}instance describing where and how control should be
	 * forwarded, or <code>null</code> if the response has already been
	 * completed.
	 * 
	 * @param mapping
	 * The ActionMapping used to select this instance
	 * @param form
	 * The optional ActionForm bean for this request (if any)
	 * @param request
	 * The HTTP request we are processing
	 * @param response
	 * The HTTP response we are creating
	 * @exception Exception
	 * if the application business logic throws an exception
	 * @since Struts 1.1
	 */
    public ActionForward execute(ActionMapping mapping, 
    		                          ActionForm form, 
    		                          HttpServletRequest request,
                                      HttpServletResponse response)
    throws Exception {
    	
    	
		if(!AppMode.getAppMode()){
			System.out.println("Application is terminated...");
			return mapping.findForward("appInfo");
		}
    	
    	/*获得用户的权限*/
    	String userSelectGrant = (String) request.getSession().getAttribute(
                                  "userSelectGrant");
    	/*获得用户可以操作的表名*/
		String userTableName = (String) request.getSession().getAttribute(
				                "userTableName");
        
    	DisplayAllBean displayallbean = new DisplayAllBean();
    	
    	/*定义StringBuffer变量,并用DisplayAllBean中的方法的返回值赋值,最后在JSP中动态的显示此变量*/
    	StringBuffer displayall = displayallbean.displayall();
    	
    	/*把生成的动态列表Set到request中去,通过JSP页面GET出来*/
		request.setAttribute("displayall", displayall);
		
		if (userTableName.indexOf("stuff") != -1 && userSelectGrant == "Y") {
			
			/*实现跳转到拥护一览页*/
		    return (mapping.findForward("displayallsuccess"));
		    
		} else {
			/*实现跳转到没有权限页*/
			return (mapping.findForward("filter"));
		}
    }
}

⌨️ 快捷键说明

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