项目路径

1,数据库中保存的附件路径; eg D:\xgxt\files

String fjSavePath = getSavePath();    
private String getSavePath() {
        RowSetIterator rs = null;
        try {
           ApplicationModule am = this.getApplicationModule();
            ViewObject vo = am.findViewObject("XtglXtszView1");
            vo.setWhereClause("Blm = 'FJPATH'");
            rs = vo.createRowSetIterator("yy");
            String blz = rs.first().getAttribute("Blz").toString();
            return blz;
        } catch (Exception e) {
            // TODO: Add catch code
            e.printStackTrace();
        } finally {
            if (rs != null) {
                rs.closeRowSetIterator();
            }

        }
        return null;
    }

 2,项目根路径

    public static String LSZPWJJ = JSFUtils.getRealPath()+ "/jwxtjsgl/image"; //临时照片文件夹(自定义路径)

    /**
     * 获取当前工程的根目录
     * @return
     * 
     */
    public static String getRealPath(){
        FacesContext fctx = FacesContext.getCurrentInstance();
        ServletContext servletCtx =
            (ServletContext)fctx.getExternalContext().getContext();
        String dirPath = servletCtx.getRealPath("/");
        return dirPath;
    }

 这里的根目录路径是发布空间的路径 eg

D:\JDevRuntime1213\system12.1.3.0.41.140521.1008\o.j2ee\drs\xgxt\KnsglViewControllerWebApp.war\

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值