标题:request 取得contextpath 和 config取得contextpath有什么区别
只看楼主
走向丶成熟
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-7-15
 问题点数:0 回复次数:0 
request 取得contextpath 和 config取得contextpath有什么区别
程序代码:
    public ActionMapping getActionMapping(HttpServletRequest request){
        String requestURI = request.getRequestURI();
        String str=request.getContextPath();
        String contextPath = config.getServletContext().getContextPath();
        System.out.println(str);
        System.out.println(contextPath);
        String actionName = requestURI.substring(contextPath.length()+1, requestURI.lastIndexOf("."));
        ActionMapping actionMapping = ActionManager.mappings.get(actionName);
        return actionMapping;
    }
搜索更多相关主题的帖子: request 
2013-07-30 21:52



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-418298-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.922221 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved