SpringSide从系统全局里面取值

 分析:

第一步:导入globle.jsp页面。该页面定义了SpringSide框架和一些系统全部变量例如:当前登录用户、weburl路径、商家平台还是坐席平台

<%@ include file="/common/globle.jsp" %>

第二步:在jsp页面利用el表达式取出系统全局里面的变量

{ display: 'logo图', name: 'logo', minWidth: 50 ,render:function(row){

                    if(row.logo!=null&&row.logo!=""){

                      return "<img src='${webUrl}"+row.logo+"' border='0'/>";[d1] 

                    }else{

                      return "";

                    }

                }

                },

第三步:在bloble.jsp里面存值

<%@ page import="com.xyz.callcenter.entity.system.SysUser"%>

<%@ page import="com.xyz.callcenter.service.system.SysConfigManager"%>

<%@ page import="com.xyz.callcenter.service.system.OperatorDetails"%>

<%@ page import="com.xyz.callcenter.utils.StringValueUtils"%>

<%@ page import="org.springside.modules.security.springsecurity.SpringSecurityUtils" %>

<%

  //current user id

  long currUserId=0;

  OperatorDetails userDetails=SpringSecurityUtils.getCurrentUser();

  SysUser currUser=userDetails.getSysuser();

  currUserId=currUser.getUserid();

  //web pre url address

  String webUrl=

SysConfigManager.getInstance().getProperty("/callcenter/modules/module[@id=1]/Parameter[@id=5]/value[d2] ");

  request.setAttribute("webUrl",webUrl[d3] );

  //systype vari

  int sysType=SysConfigManager.getInstance().getSysType();

  request.setAttribute("systype",""+sysType);

%>

第四步:到CallCenterConfig.xml配置文件中,配置获取logo图的路径

  <modules>

        <!-- 系统管理模块配置 id:以便统一管理-->

       <module id="1" name="系统管理">        

        <Parameter id="5" isshow="true">

            <name>Web服务器地址</name>

           <description>

           Web服务器地址、用于访问图片、附件

           </description>

             <value>http://192.168.185.29:90</value>[d4] 

        </Parameter>         

      </module>

 

      <module id="2" name="坐席业务">     

      </module>

   </modules>


 [d1]El

 [d2]这个参数是来自web项目web-info下的全局系统变量配置文件CallCenterConfig.xml

 [d3]把变量存在request

 [d4]配服务器的地址到端口号

posted @ 2013-08-30 11:20  一杯水的天堂  阅读(315)  评论(0编辑  收藏  举报