首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

引用一个jsp文件 报错 初学者有关问题 大家来捡分了…

2012-01-28 
引用一个jsp文件 报错 菜鸟问题 大家来捡分了……我写了%@include fileTestIncludeHead.jsp %这个 可是

引用一个jsp文件 报错 菜鸟问题 大家来捡分了……
我写了
<%@include file="TestIncludeHead.jsp" %>
这个 可是报错
Multiple annotations found at this line:
- Duplicate local variable basePath
- Duplicate local variable path

Java code
这事怎么回事?<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>  <%@include file="TestIncludeHead.jsp" %>    <base href="<%=basePath%>">        <title>My JSP 'TestIncledeFoot.jsp' starting page</title>        <meta http-equiv="pragma" content="no-cache">    <meta http-equiv="cache-control" content="no-cache">    <meta http-equiv="expires" content="0">        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">    <meta http-equiv="description" content="This is my page">    <!--    <link rel="stylesheet" type="text/css" href="styles.css">    -->  </head>    <body>    This is my JSP page. <br>  </body></html>


[解决办法]
TestIncludeHead.jsp里的头文件和这个文件里的头文件重复了
[解决办法]
HTML code
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>  <head>  <title>My JSP 'TestIncledeFoot.jsp' starting page</title> </head>  <body>  This is my JSP page. <br>  </body> </html>
[解决办法]
探讨
怎么解决?总不能把
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
删了吧

热点排行