今天在做商城页面,遇到问题:

<%@include file="menu.jsp" %>

错误提示:

Multiple annotations found at this line:
 - Duplicate local variable path
 - Duplicate local variable 
  basePath

重复变量,

改成: <jsp:include page="menu.jsp"> 也不行

查资料:

因为<%@include%>引进的是代码,把代码包含进来,而新进JSP时,会默认生成

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<base href="<%=basePath%>">

这二句代码,所以用<%@include%>引进页面是就报重复变量 basePath

解决方法,把要引进页面的重复的句子去掉就行,

另外:

查询到 <%@ include file=""%>与<jsp:include page=""/> 的区别:

一、执行时间上: 
<%@ include file=”relativeURI”%> 是在翻译阶段执行 
<jsp:include page=”relativeURI” flush=”true” /> 在请求处理阶段执行。 
二、二:引入内容的不同: 
<%@ include file=”relativeURI”%> 引入静态文本(html,jsp),在JSP页面被转化成servlet之前和它融和到一起。 
<jsp:include page=”relativeURI” flush=”true” /> 引入执行页面或servlet所生成的应答文本。

翻译:  JSP容器负责将jsp页面转化成servlet,并编译这个servlet。

JSP :使用<%@include%>报Duplicate local variable path 错误的更多相关文章

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

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

  2. JSP页面使用include指令出现 Duplicate local variable basePath

    现有三个页面 " include.jsp " " a.jsp " " b.jsp " 页面代码如下 首先是a.jsp <%@ page ...

  3. jsp的<%@ include file="jsp/common.jsp" %>报错误Duplicate local variable basePath

    将公共引入的文件放到common.jsp中,其他页面引入该jsp即可使用 <%@ page language="java" import="java.util.*& ...

  4. Oracle 11g安装报错Environment variable: "PATH"

    Environment variable: "PATH" - This test checks whether the length of the environment vari ...

  5. Oracle安装client客户端报错Environment variable: "PATH"

    安装时出行这个错误 Environment variable: "PATH" 解决方法 1.找到你的安装包里的这个路径下的这两个文件 2.用文本方式打开 将里两个文件面所有的102 ...

  6. Eclipse连接数据库报错Local variable passwd defined in an enclosing scope must be final or effectively final

    其实原因很简单,就是翻译的结果 匿名内部类和局部内部类只能引用外部的fianl变量 把变量变成fianl就行了  第一次知道啊    记小本本.......

  7. JSP中用include标签动态引入其它文件报错

    <jsp:include page="<%=path %>/include.jsp"></jsp:include> 报错:attribute f ...

  8. 洗礼灵魂,修炼python(23)--自定义函数(4)—闭包进阶问题—>报错UnboundLocalError: local variable 'x' referenced before assignment

    闭包(lexical closure) 什么是闭包前面已经说过了,但是由于遗留问题,所以单独作为一个章节详解讲解下 不多说,看例子: def funx(x): def funy(y): return ...

  9. [合集]解决Python报错:local variable 'xxx' referenced before assignment

    a = 1 def use(): print(a) #输出1 引用不会报错 a = 1 def use(): a = 3 print(a) #输出 3 重新赋值也不会报错. 局部变量会优先在函数内部去 ...

随机推荐

  1. 纯CSS制作图形效果

    下面所有的例子都是在demo.html的基础上添加相关样式实现的. <!DOCTYPE html> <html> <head> <meta charset=& ...

  2. CentOS7和CentOS6怎样开启MySQL远程访问

    CentOS6开启MySQL远程访问 1.开放MySQL访问端口3306 修改防火墙配置文件 vi /etc/sysconfig/iptables  加入端口配置      -A INPUT -m s ...

  3. day2模块初识别

    sys_mod.py import sys print(sys.argv) #['C:/Users/Administrator/desktop/s17/day2/sys_mod.py'] 打印脚本的绝 ...

  4. synchronized和lock以及synchronized和volatile的区别

    synchronized和volatile区别synochronizd和volatile关键字区别: 1. volatile关键字解决的是变量在多个线程之间的可见性:而sychronized关键字解决 ...

  5. Sql入门学习——基本语法函数

    --------使用工具navicat 快捷键操作 --------基本操作DML &DDL --------运算比较 --------数据类型 --------常用函数 --------常用 ...

  6. RK3288 mipi屏参数配置文件

    RK3288     Android 5.1系统     Linux 3.10 mipi屏参数配置文件所在的路径:kernel/arch/arm/boot/dts/xxx_mipi.dtsi 屏参数配 ...

  7. python中os模块

    os  模块 操作系统模块,该模块主要处理与操作系统相关的操作 最常用是文件操作:打开.读取 import os os.getcwd() #获取当前执行文件夹路径 ​ os.chdir('dirnam ...

  8. JSON数据的解析和生成(C++)

    安装 "JSON for Modern C++" $ brew tap nlohmann/json $ brew install nlohmann_json 安装之后将/usr/l ...

  9. pynlpir 报错 Cannot Save user dictionary 原因与解决方法

    在使用pynlpir和用户自定义词典进行分词时,如果报出如下错误: [2017-12-09 18:05:51] Cannot Save user dictionary Cannot write log ...

  10. R语言-图的要素颜色

    1.设置图形要素的颜色 Plot函数中,使用col=参数来决定要素的颜色 如果不指定plot type,颜色加在散点上,如果指定了plot type,例如line,则颜色加在线上 其它函数,例如bar ...