/**
* @Description: 设置全局变量
* @author 猪肉有毒 waitfox@qq.com  
* @date 2015年6月8日 上午9:53:09 
* @version V1.0  
* 我只为你回眸一笑，即使不够倾国倾城，我只为你付出此生，换来生再次相守
*/
package com.baicai.core;

import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.beetl.core.GroupTemplate;
import org.beetl.ext.spring.BeetlGroupUtilConfiguration;

import com.baicai.util.PropertiesTool;

public class ContextLoaderListener implements ServletContextListener{

	@Override
	public void contextDestroyed(ServletContextEvent event) {
		
	}

	@Override
	public void contextInitialized(ServletContextEvent event) {
		ServletContext servletContext = event.getServletContext();
        servletContext.setAttribute("systemx", "");
        BeetlGroupUtilConfiguration config= (BeetlGroupUtilConfiguration) SpringUtils.getApplicationContext().getBean("beetlConfig");
        GroupTemplate group = config.getGroupTemplate();//此处可处理模板全局变量
        Map<String,Object> shared = new HashMap<String,Object>();
        shared.put("version", "0.01");
        shared.put("path", PropertiesTool.get("system", "BASEURL"));
        group.setSharedVars(shared);
        System.out.println(group.getSharedVars());
	}

}

@@ -1120,196 +1120,148 @@
     
-shared.put(%22version%22, %220.01%22);%0D%0A        shared.put(%22path%22, PropertiesTool.get(%22system%22, %22BASEURL%22));%0D%0A        group.setSharedVars(shared);%0D%0A        System.out.println(group.getSharedVars()
+String path=BaseTool.getServer()+servletContext.getContextPath()+%22/%22;%0D%0A        shared.put(%22path%22, path);%0D%0A        group.setSharedVars(shared
 );%0D%0A

改进获取网站根路径的算法，tomcat 6/7/8 测试成功