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

📄 abstractaction.java

📁 用jsp,java写的在线购物系统
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   AbstractAction.java

package mediastore.web.struts;

import java.io.PrintStream;
import javax.servlet.GenericServlet;
import javax.servlet.ServletContext;
import javax.servlet.http.*;
import mediastore.dao.TestEditionControl;
import mediastore.web.global.ApplicationContext;
import mediastore.web.global.Globals;
import org.apache.struts.action.*;
import org.apache.struts.config.ForwardConfig;

// Referenced classes of package mediastore.web.struts:
//            ActionContext

public abstract class AbstractAction extends Action
{

    public static final String LAST_FORWARD_KEY = "mediastore.web.struts.AbstractAction.LAST_FORWARD_KEY";

    public AbstractAction()
    {
    }

    public abstract ActionForward execute(ActionContext actioncontext)
        throws Exception;

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
        throws Exception
    {
        System.out.println("---Start: AbstractAction::execute(mapping,form,request,response)---");
        ActionForward forward = null;
        ActionContext actionContext = new ActionContext(this, mapping, form, request, response, getLocale(request));
        try
        {
            ServletContext ctx = getServlet().getServletContext();
            ApplicationContext actx = ApplicationContext.getInstance();
            actx.setDburl(ctx.getInitParameter("dburl"));
            actx.setUser(ctx.getInitParameter("user"));
            actx.setPassword(ctx.getInitParameter("password"));
            forward = execute(actionContext);
            System.out.println("forward.getPath:" + forward.getPath());
            System.out.println("forward.getName:" + forward.getName());
            HttpSession tmpsession = actionContext.getRequest().getSession(false);
            if(tmpsession == null || tmpsession.getAttribute(Globals.SESSION_CONTEXT) == null)
            {
                System.out.println("会话过期");
                forward = actionContext.getMapping().findForward("Login");
            }
            TestEditionControl tec = new TestEditionControl();
            int recCount = tec.getRecCount();
            if(recCount > 0)
            {
                int totalDays = tec.getTotalDays();
                int usedDays = tec.getUsedDays();
                if(usedDays > totalDays)
                {
                    System.out.println("试用到期");
                    forward = actionContext.getMapping().findForward("Login");
                }
            }
        }
        catch(Exception e)
        {
            throw e;
        }
        HttpSession session = actionContext.getSession();
        if(!forward.getName().equals("Login"))
        {
            if(session != null)
                session.setAttribute("mediastore.web.struts.AbstractAction.LAST_FORWARD_KEY", forward);
        } else
        {
            session.invalidate();
        }
        System.out.println("---End: AbstractAction::execute(mapping,form,request,response)---");
        return forward;
    }
}

⌨️ 快捷键说明

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