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

📄 adminattachset.java

📁 java论坛
💻 JAVA
字号:
package com.laoer.bbscs.web.action;

import javax.servlet.http.*;

import org.apache.struts.action.*;
import com.laoer.bbscs.service.config.*;
import com.laoer.bbscs.web.form.*;
import com.laoer.bbscs.exception.*;

public class AdminAttachSet
    extends Action {

  private SysConfig sysConfig;

  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                               HttpServletResponse response) {
    AdminAttachSetForm adminAttachSetForm = (AdminAttachSetForm) form;

    if (adminAttachSetForm.getAction().equalsIgnoreCase("index")) {
      adminAttachSetForm.setAction("save");
      adminAttachSetForm.setAttachFileType(this.getSysConfig().getAttachFileType());
      adminAttachSetForm.setAttachImgRow(this.getSysConfig().getAttachImgRow());
      adminAttachSetForm.setAttachImgType(this.getSysConfig().getAttachImgType());
      adminAttachSetForm.setAttachmentNum(this.getSysConfig().getAttachmentNum());
      adminAttachSetForm.setCanDelAttachmentClosedPost(this.getSysConfig().
          getCanDelAttachmentClosedPost());
      adminAttachSetForm.setCanDelAttachmentOverTime(this.getSysConfig().
          getCanDelAttachmentOverTime());
      adminAttachSetForm.setReduceAttachImg(this.getSysConfig().getReduceAttachImg());
      adminAttachSetForm.setReduceAttachImgSize(this.getSysConfig().getReduceAttachImgSize());
      adminAttachSetForm.setViewAttachImg(this.getSysConfig().getViewAttachImg());
      adminAttachSetForm.setAttachFileSize(this.getSysConfig().getAttachFileSize());
      return mapping.findForward("attachSet");
    }

    if (adminAttachSetForm.getAction().equalsIgnoreCase("save")) {
      ActionMessages messages = new ActionMessages();
      this.getSysConfig().setAttachFileType(adminAttachSetForm.getAttachFileType());
      this.getSysConfig().setAttachImgRow(adminAttachSetForm.getAttachImgRow());
      this.getSysConfig().setAttachImgType(adminAttachSetForm.getAttachImgType());
      this.getSysConfig().setAttachmentNum(adminAttachSetForm.getAttachmentNum());
      this.getSysConfig().setCanDelAttachmentClosedPost(adminAttachSetForm.
          getCanDelAttachmentClosedPost());
      this.getSysConfig().setCanDelAttachmentOverTime(adminAttachSetForm.
          getCanDelAttachmentOverTime());
      this.getSysConfig().setReduceAttachImg(adminAttachSetForm.getReduceAttachImg());
      this.getSysConfig().setReduceAttachImgSize(adminAttachSetForm.getReduceAttachImgSize());
      this.getSysConfig().setViewAttachImg(adminAttachSetForm.getViewAttachImg());
      this.getSysConfig().setAttachFileSize(adminAttachSetForm.getAttachFileSize());
      try {
        this.getSysConfig().saveConfigs();
        messages.add("resultMsg", new ActionMessage("bbscs.dataupdate.succeed"));
        this.saveMessages(request, messages);
      }
      catch (SysConfigException ex) {
        messages.add("error.dataupdate.failed", new ActionMessage("error.dataupdate.failed"));
        this.saveErrors(request, messages);
      }
      return mapping.findForward("attachSet");
    }

    return mapping.getInputForward();
  }

  public SysConfig getSysConfig() {
    return sysConfig;
  }

  public void setSysConfig(SysConfig sysConfig) {
    this.sysConfig = sysConfig;
  }
}

⌨️ 快捷键说明

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