怎么在jsp java代码中嵌入forward动作标签

如题所述

    redirect(重定向):服务端发送给客户端一个重定向的临时响应头,这个响应头包含重定向之后的URL,客户端用新的URL重新向服务器发送一个请求。
    2. forward(请求转向):服务器程序内部请求转向,这个特性允许前一个程序用于处理请求,而后一个程序用来返回响应。

public void sendRedirect(String location)   
        throws IOException {  
  
        if (isCommitted())  
            throw new IllegalStateException  
                (sm.getString("coyoteResponse.sendRedirect.ise"));  
  
        // Ignore any call from an included servlet  
        if (included)  
            return;   
  
        // Clear any data content that has been buffered  
        resetBuffer();  
  
        // Generate a temporary redirect to the specified location  
        try {  
            String absolute = toAbsolute(location);  
            setStatus(SC_FOUND);  
            setHeader("Location", absolute);  
        } catch (IllegalArgumentException e) {  
            setStatus(SC_NOT_FOUND);  
        }  
  
        // Cause the response to be finished (from the application perspective)  
        setSuspended(true);  
}


温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网