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

📄 baseaction.java

📁 大象购物管理程序
💻 JAVA
字号:
package com.comm;

import java.io.*;

import javax.servlet.http.*;

import org.apache.struts.action.*;
import org.apache.struts.actions.*;

public class BaseAction extends DispatchAction implements Serializable {

    public boolean formRelease; //如果当前Form与前面Form不相同时是否将前面的Form清空

    public BaseAction() {
        this.setFormRelease(true);
    }


    public final ActionForward execute(ActionMapping actionmapping,
                                       ActionForm actionform,
                                       HttpServletRequest httpServletRequest,
                                       HttpServletResponse httpServletResponse) throws
            javax.servlet.ServletException, java.io.IOException,
            Exception {

        return super.execute(actionmapping, actionform, httpServletRequest,
                             httpServletResponse);
    }


    protected final void release(ActionMapping currentMapping,
                                 HttpServletRequest aHttpServletRequest) {
        HttpSession session = aHttpServletRequest.getSession(false);
        if (session == null) {
            return;
        }
        ActionMapping mapping = currentMapping;
        String form = mapping.getAttribute();
        if (form != null && session.getAttribute(form) != null) {
            session.removeAttribute(form);
        }
    }

    protected final void release(String currentForm,
                                 HttpServletRequest aHttpServletRequest) {
        HttpSession session = aHttpServletRequest.getSession(false);
        if (session == null) {
            return;
        }
        if (currentForm != null && session.getAttribute(currentForm) != null) {
            session.removeAttribute(currentForm);
        }
    }

    public void setFormRelease(boolean formRelease) {
        this.formRelease = formRelease;
    }
}

⌨️ 快捷键说明

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