为什么我的 <%@ include file="Buy.jsp" %>这一行一直出现错误,如果改成<jsp:include>标签的话就没有了!
错误为:Multipleannotationsfoundatthisline:-Duplicatelocalvariablepath-Duplicatelocalvari...
错误为:Multiple annotations found at this line:
- Duplicate local variable path
- Duplicate local variable
应该是路径的问题,可是怎么解决啊??我要用为什么我的 <%@ include file="Buy.jsp" %>
代码如下:<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:useBean id="cart" scope="session" class="com.cn.select.select"></jsp:useBean>
<%
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>
<base href="<%=basePath%>" >
<title>My JSP 'conform.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>
<jsp:setProperty property="item" name="cart" value="<%=request.getParameter("item")%>"/>
<jsp:setProperty property="submit" name="cart" value="<%=request.getParameter("submit")%>"/>
<% cart.processRequest(); %>
<font size=4 color="#cc0000">
<br>您选择了如下商品:
<br>
<ol>
<%
String[] items=cart.getItems();
for(int i=0;i<items.length;i++)
{
String str=new String(items[i].getBytes("iso-8859-1"),"utf-8");
%>
<li><%=str%></li>
<% } %>
</ol>
</font>
</body>
<jsp:include flush="true" page="Buy.jsp"></jsp:include>
<%@ include file="Buy.jsp" %>
</html>
工程的目录结构如下: 展开
- Duplicate local variable path
- Duplicate local variable
应该是路径的问题,可是怎么解决啊??我要用为什么我的 <%@ include file="Buy.jsp" %>
代码如下:<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:useBean id="cart" scope="session" class="com.cn.select.select"></jsp:useBean>
<%
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>
<base href="<%=basePath%>" >
<title>My JSP 'conform.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>
<jsp:setProperty property="item" name="cart" value="<%=request.getParameter("item")%>"/>
<jsp:setProperty property="submit" name="cart" value="<%=request.getParameter("submit")%>"/>
<% cart.processRequest(); %>
<font size=4 color="#cc0000">
<br>您选择了如下商品:
<br>
<ol>
<%
String[] items=cart.getItems();
for(int i=0;i<items.length;i++)
{
String str=new String(items[i].getBytes("iso-8859-1"),"utf-8");
%>
<li><%=str%></li>
<% } %>
</ol>
</font>
</body>
<jsp:include flush="true" page="Buy.jsp"></jsp:include>
<%@ include file="Buy.jsp" %>
</html>
工程的目录结构如下: 展开
4个回答
展开全部
你把<HTML>标签前面的枝友这一段代码<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>跟 <base href="<%=basePath%>" >这一段去掉就行了,因为你的Buy.jsp页面中也有相同的代猛孙槐码所以凯袜冲突了,我刚开始学的时候也碰到这样的问题.希望对你有帮助!
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>跟 <base href="<%=basePath%>" >这一段去掉就行了,因为你的Buy.jsp页面中也有相同的代猛孙槐码所以凯袜冲突了,我刚开始学的时候也碰到这样的问题.希望对你有帮助!
展开全部
重新 建个jsp文件 把Body 和一些东西复制进去 不要删除原有的软件的代码 试试看
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%@include file="relativeURL"%>
include 指令为静态包含。 所包含的文件,也必和袜须设置 contentType 或 pageEncoding
所以,要在
head.css文件开头处中加入
<%@page contentType="text/html;charset=gb2312"%>
或顷棚圆者<%@page pageEncoding="gb2312"%>雀塌
include 指令为静态包含。 所包含的文件,也必和袜须设置 contentType 或 pageEncoding
所以,要在
head.css文件开头处中加入
<%@page contentType="text/html;charset=gb2312"%>
或顷棚圆者<%@page pageEncoding="gb2312"%>雀塌
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"衫简耐/";
%>
<咐举%@ include file="Buy.jsp" %>或春
把页面前面path变量加上试试看 。。。<%@ include file=path+"/Buy.jsp" %>
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"衫简耐/";
%>
<咐举%@ include file="Buy.jsp" %>或春
把页面前面path变量加上试试看 。。。<%@ include file=path+"/Buy.jsp" %>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询