在 JSP 中,响应是一种隐式对象,其类型为 HttpServletResponse。每个 JSP 请求的 HttpServletResponse 实例由 Web 容器创建。

它可用于添加或操作响应,例如将响应重定向到另一个资源,发送错误等。

让我们看一个响应隐式对象的示例,在这个示例中,我们将响应重定向到 Google。

响应隐式对象的示例

index.html

<form action="welcome.jsp">  
<input type="text" name="uname">  
<input type="submit" value="go"><br/>  
</form>  

welcome.jsp

<%   
response.sendRedirect("http://www.google.com");  
%>  

输出

2.jpg

标签: JSP, JSP教程, JSP技术, JSP快速入门, JSP简单用法, JSP编程, JSP下载, JSP基本语法, JSP安装教程, JSP库, JSP指南, JSP基础教程, JSP初级教程, JSP进阶教程