当前位置: 代码迷 >> Java相关 >> request 取得contextpath 和 config取得contextpath有什么区别
  详细解决方案

request 取得contextpath 和 config取得contextpath有什么区别

热度:389   发布时间:2013-07-30 21:52:13.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  

----------------解决方案--------------------------------------------------------
  相关解决方案