jsp补习

本文介绍了JSP页面中使用<jsp:useBean>标签来声明和使用bean的方法,并详细展示了如何通过request对象获取HTTP请求的基本信息,如请求方式、服务器名称等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 1 。<jsp:useBean id="box" class="com.jsfabc.jsh.view.bean.Box"

scope="session"> page,request,application
page只在页面内有效,request只在一次跳转中有效, session会话,
application一次服务启动到停止期间

2.request基本信息
<h2>Request的基本信息</h2>
Request Method:<%out.print(request.getMethod());%>
<br>
Server Name:<%out.print(request.getServerName());%>
<br>
RemoteAddress:<%out.print(request.getRemoteAddr());%>
<br>
Content Type:<%out.print(request.getContentType());%>
<br>
Request URI:<%out.print(request.getRequestURI());%>
<br>
Host:<%out.print(request.getHeader("Host"));%>
Request的基本信息
Request Method:GET
Server Name:localhost
RemoteAddress:127.0.0.1
Content Type:null
Request URI:/工程名/本页名字.jsp
Host:localhost:8080

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值