ForwardTag.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:lams 作者:
/**
 * Redirect to the given path converting exceptions to JspException.
 * @param path The path to redirect to.
 * @throws JspException
 * @since Struts 1.2
 */
protected void doRedirect(String path) throws JspException {
    HttpServletRequest request =
        (HttpServletRequest) pageContext.getRequest();

    HttpServletResponse response =
        (HttpServletResponse) pageContext.getResponse();

    try {
        if (path.startsWith("/")) {
            path = request.getContextPath() + path;
        }

        response.sendRedirect(response.encodeRedirectURL(path));

    } catch (Exception e) {
        TagUtils.getInstance().saveException(pageContext, e);
        throw new JspException(
            messages.getMessage("forward.redirect", name, e.toString()));
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号