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

📄 opencopyaction.java

📁 完整的合同管理信息系统
💻 JAVA
字号:
package com.ICT.AFC.contract.actions;

import org.apache.struts.action.*;
import javax.servlet.http.*;
import java.io.IOException;
import javax.servlet.ServletContext;
import javax.sql.DataSource;
import com.ICT.AFC.DB.DB;
import com.ICT.AFC.contract.beans.ContractOperate;

public class OpenCopyAction extends Action {
  public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws
      IOException, Exception {

    HttpSession session = httpServletRequest.getSession();
    ServletContext context = servlet.getServletContext();
    DataSource dataSource = (DataSource) context.getAttribute("contract");
    DB db = new DB(dataSource);
    String PageForward = "twoShowContractInf";

    String copy = new String(httpServletRequest.getParameter("Copy").getBytes("ISO8859_1"));

    //判断文件类型
    if(copy.indexOf(".doc")!=-1)
    {
           Runtime.getRuntime().exec("C:\\Program Files\\Microsoft Office\\OFFICE11\\WINWORD.EXE "+copy);
    }
    if(copy.indexOf(".xls")!=-1)
    {
           Runtime.getRuntime().exec("C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.EXE "+copy);
    }
    if(copy.indexOf(".pdf")!=-1)
    {
         Runtime.getRuntime().exec("C:\\Program Files\\Adobe\\Acrobat 7.0\\Reader\\AcroRd32.exe "+copy);
    }




    String contractid = httpServletRequest.getParameter("contractId");//提取要浏览的合同id号
    int contractId = Integer.parseInt(contractid);

    session.setAttribute("twoShowContractInf",
                         ContractOperate.searchContract(db, contractId));
    //从数据库中提取合同信息放置session中,方便页面显示
    db.close();


   return (actionMapping.findForward(PageForward));
  }
}

⌨️ 快捷键说明

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