JSP 使用<%@include%>报Duplicate local variable path 错误 解决方法 .

JSP 使用<%@include%>报Duplicate local variable path 错误 解决方法 .

错误提示:
Multiple annotations found at this line:
- Duplicate local variable path
- Duplicate local variable
basePath

重复变量,
因为<%@include%>引进的是代码,把代码包含进来,而新进JSP时,会默认生成
< %
String path = request.getContextPath();
String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
%>

<base href=”<%=basePath%>”>
这二句代码,所以用<%@include%>引进页面是就报重复变量 basePath
解决方法,把要引进页面这句去掉就行,

不想删掉,因为要用到“path”这个变量,用来指定CSS路径,怎么办????????????
.搞定了,有2个方法

重命名path和basePath变量,,要不不引用path,直接用request.getContextPath();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值