簡體   English   中英

在我的jsp頁面上包含jsp文件時出錯

[英]Error when including jsp files on my jsp page

我試圖在我的JSP頁面中包含2個JSP文件。 我的主頁稱為temp.jsp,它位於我的Web項目tempFolder的子文件夾中。 我試圖在主項目文件夾中包含一個文件(稱為invalidcqs.jsp),並在主項目文件夾的子文件夾(envmon)中包含一個文件(稱為env_status_report.jsp)。

我的temp.jsp文件中的代碼是:

<html>
  <head>
    <title>Screen1 using includes</title>
    <meta http-equiv="refresh" content="10"/>
  </head>
  <body style="background-color:#E6E6FA">
  <%@ include file="../envmon/env_status_report.jsp" %>
    <br><hr><br>
    <%@ include file="../invalidcqs.jsp" %>
  </body>
</html

第二個include <%@ include file="../invalidcqs.jsp" %>工作正常,但第一個<%@ include file="/../envmon/env_status_report.jsp" %>顯示Eclipse中的錯誤。

錯誤文本為:

 Multiple annotations found at this line: - Syntax error on token "else", delete this token - Syntax error, insert "Finally" to complete TryStatement - Syntax error on token "else", delete this token 

有誰知道為什么Eclipse不喜歡這樣?

通常,我不太關心jsp頁面上的Eclipse報告錯誤,特別是在使用<%@ include>指令時。 例如,如果您在主頁中聲明scriptlet變量並在包含的頁面中使用它,則Eclipse將抱怨在包含的頁面中未聲明它,但是它將在運行時正常工作。

該錯誤可能是從所包含的jsp中發出的,因此我將開始在其中查找此錯誤。

您也可以嘗試以EL方式包含頁面: <jsp:include page="/WEB-INF/pages/received.shtml" />也許會有所幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM