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

📄 cssaction.java

📁 天乙代码src_531.rar 天乙代码src_531.rar 天乙代码src_531.rar 天乙代码src_531.rar
💻 JAVA
字号:
package com.laoer.bbscs.bbs.action;

import org.apache.struts.action.*;
import javax.servlet.http.*;
import com.laoer.bbscs.servlet.*;
import com.laoer.bbscs.sysinfo.*;
import com.laoer.bbscs.bbs.actionform.*;
import com.laoer.bbscs.bbs.business.*;
import com.laoer.bbscs.util.*;

public class CssAction
    extends Action {
  public ActionForward execute(ActionMapping actionMapping,
                               ActionForm actionForm,
                               HttpServletRequest httpServletRequest,
                               HttpServletResponse httpServletResponse) {
    ActionErrors errors = new ActionErrors();
    CssActionForm form = (CssActionForm) actionForm;
    AdminSession myAdminSession = new AdminSession(httpServletRequest);
    if (!myAdminSession.checkSession()) {
      errors.add("error.timeout",
                 new ActionError("error.timeout"));
      saveErrors(httpServletRequest, errors);
      return actionMapping.findForward("error");
    }
    if (form.getAction().equals("new")) {
      CSSInfo aCSSInfo = new CSSInfo();
      httpServletRequest.setAttribute("cssinfo", aCSSInfo);
      httpServletRequest.setAttribute("act", "add");
      errors = null;
      form = null;
      myAdminSession = null;
      return actionMapping.findForward("newcss");
    }
    if (form.getAction().equals("edit")) {
      CSSInfo aCSSInfo = new CSSInfo();
      aCSSInfo.setID(Long.parseLong(form.getCssID()));
      CSS aCSS = CSSFactory.getInstance();
      aCSS.setCSSInfo(aCSSInfo);
      aCSS.getCSS(null, "ID", true);
      aCSSInfo = aCSS.getCSSInfo();
      httpServletRequest.setAttribute("cssinfo", aCSSInfo);
      httpServletRequest.setAttribute("act", "editdo");
      errors = null;
      form = null;
      myAdminSession = null;
      aCSSInfo = null;
      aCSS = null;
      return actionMapping.findForward("newcss");
    }
    if (form.getAction().equals("add")) {
      CSSInfo aCSSInfo = new CSSInfo();
      aCSSInfo.setID(Util.getaLongTime());
      aCSSInfo.setLeftbgcolor(form.getLeftbgcolor());
      aCSSInfo.setLetftextcolor(form.getLetftextcolor());
      aCSSInfo.setRightbgcolor(form.getRightbgcolor());
      aCSSInfo.setRighttextcolor(form.getRighttextcolor());
      aCSSInfo.setTablemaincolor(form.getTablemaincolor());
      aCSSInfo.setTabledarkcolor(form.getTabledarkcolor());
      aCSSInfo.setTabletintcolor(form.getTabletintcolor());
      aCSSInfo.setLeft_a(form.getLeft_a());
      aCSSInfo.setLeft_alink(form.getLeft_alink());
      aCSSInfo.setLeft_avisited(form.getLeft_avisited());
      aCSSInfo.setLeft_ahover(form.getLeft_ahover());
      aCSSInfo.setLeft_aactive(form.getLeft_aactive());
      aCSSInfo.setRight_a(form.getRight_a());
      aCSSInfo.setRight_alink(form.getRight_alink());
      aCSSInfo.setRight_avisited(form.getRight_avisited());
      aCSSInfo.setRight_ahover(form.getRight_ahover());
      aCSSInfo.setRight_aactive(form.getRight_aactive());
      aCSSInfo.setAllfonts(form.getAllfonts());
      CSS aCSS = CSSFactory.getInstance();
      aCSS.setCSSInfo(aCSSInfo);
      if (aCSS.createCSS(null) != Sys.RESULT_RIGHT) {
        errors.add("error.handlerror", new ActionError("error.handlerror"));
        saveErrors(httpServletRequest, errors);
        return actionMapping.findForward("error");
      }
      httpServletRequest.setAttribute("aForwardInfo",
                                      new ForwardInfo("",
          Sys.SYSINFO.ROOTWEBPATH + "webProAction.do?action=show"));
      errors = null;
      form = null;
      myAdminSession = null;
      aCSSInfo = null;
      aCSS = null;
      return actionMapping.findForward("forwards");
    }
    if (form.getAction().equals("editdo")) {
      CSSInfo aCSSInfo = new CSSInfo();
      aCSSInfo.setID(Long.parseLong(form.getCssID()));
      aCSSInfo.setLeftbgcolor(form.getLeftbgcolor());
      aCSSInfo.setLetftextcolor(form.getLetftextcolor());
      aCSSInfo.setRightbgcolor(form.getRightbgcolor());
      aCSSInfo.setRighttextcolor(form.getRighttextcolor());
      aCSSInfo.setTablemaincolor(form.getTablemaincolor());
      aCSSInfo.setTabledarkcolor(form.getTabledarkcolor());
      aCSSInfo.setTabletintcolor(form.getTabletintcolor());
      aCSSInfo.setLeft_a(form.getLeft_a());
      aCSSInfo.setLeft_alink(form.getLeft_alink());
      aCSSInfo.setLeft_avisited(form.getLeft_avisited());
      aCSSInfo.setLeft_ahover(form.getLeft_ahover());
      aCSSInfo.setLeft_aactive(form.getLeft_aactive());
      aCSSInfo.setRight_a(form.getRight_a());
      aCSSInfo.setRight_alink(form.getRight_alink());
      aCSSInfo.setRight_avisited(form.getRight_avisited());
      aCSSInfo.setRight_ahover(form.getRight_ahover());
      aCSSInfo.setRight_aactive(form.getRight_aactive());
      aCSSInfo.setAllfonts(form.getAllfonts());
      CSS aCSS = CSSFactory.getInstance();
      aCSS.setCSSInfo(aCSSInfo);
      if (aCSS.updateCSS(null, "ID") != Sys.RESULT_RIGHT) {
        errors.add("error.handlerror", new ActionError("error.handlerror"));
        saveErrors(httpServletRequest, errors);
        return actionMapping.findForward("error");
      }
      httpServletRequest.setAttribute("aForwardInfo",
                                      new ForwardInfo("",
          Sys.SYSINFO.ROOTWEBPATH + "webProAction.do?action=show"));
      errors = null;
      form = null;
      myAdminSession = null;
      aCSSInfo = null;
      aCSS = null;
      return actionMapping.findForward("forwards");
    }
    if (form.getAction().equals("del")) {
      CSSInfo aCSSInfo = new CSSInfo();
      aCSSInfo.setID(Long.parseLong(form.getCssID()));
      CSS aCSS = CSSFactory.getInstance();
      aCSS.setCSSInfo(aCSSInfo);
      if (aCSS.delCSS(null) != Sys.RESULT_RIGHT) {
        errors.add("error.handlerror", new ActionError("error.handlerror"));
        saveErrors(httpServletRequest, errors);
        return actionMapping.findForward("error");
      }
      httpServletRequest.setAttribute("aForwardInfo",
                                      new ForwardInfo("",
          Sys.SYSINFO.ROOTWEBPATH + "webProAction.do?action=show"));
      errors = null;
      form = null;
      myAdminSession = null;
      aCSSInfo = null;
      aCSS = null;
      return actionMapping.findForward("forwards");
    }
    return actionMapping.findForward("error");
  }
}

⌨️ 快捷键说明

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