1

I am trying to include 2 JSP files in my JSP page. My main page is called temp.jsp - this is in a subfolder in my web project called tempFolder. I am trying to include a file in the main project folder (called invalidcqs.jsp) and a file (called env_status_report.jsp) in a sub folder (envmon) of the main project folder.

the code in my temp.jsp file is:

<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

The second include <%@ include file="../invalidcqs.jsp" %> works fine but the first one <%@ include file="/../envmon/env_status_report.jsp" %> shows an error in Eclipse.

The text of the error is:

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

Does anyone know why Eclipse doesn't like this?

Matt
  • 74,352
  • 26
  • 153
  • 180
JigglyPuff
  • 31
  • 1
  • 3
  • 5

2 Answers2

0

Usually I don't care much about Eclipse reporting errors on jsp pages, specially when using the <%@ include> directive. For instance, if you declare a scriptlet variable in your main page and use it in the included page, Eclipse will complain about it not being declared while in the included page, but it will work all right at runtime.

This error is possibly coming out of the included jsp, so I'd start looking for this error inside it.

Xavi López
  • 27,550
  • 11
  • 97
  • 161
  • For that you should just make sure the JSP Validation preference to validate Fragments on their own is disabled. – nitind Oct 13 '11 at 17:34
  • That's a nice tip, @nitind, I'll use it when I work again with JSP. I hope it'll be a long time before I have to, I'm getting too used to Wicket :-) – Xavi López Oct 13 '11 at 18:00
0

You could also try to include pages the EL way: <jsp:include page="/WEB-INF/pages/received.shtml" /> Maybe that will help

MartijnvdB
  • 922
  • 9
  • 23
  • 1
    `` is not EL. It's a [JSP 1.1 dynamic include](http://java.sun.com/products/jsp/tags/11/syntaxref1112.html#8828). The OP is using [static includes](http://java.sun.com/products/jsp/tags/11/syntaxref117.html#8772). This question discusses diferences between `` and `<%@ include>`: [include directive and attribute name problem](http://stackoverflow.com/q/1271329/851811) – Xavi López Oct 05 '11 at 09:45