14

I tried to include an HTML file to my JSP but I eclipse show'd this error

The included file

<%@include file="includes/head.html" %>

And the error

Processing instruction not closed

And this is just the simple JSP

<%@include file = "includes/head.html" %>

    <form action = "#" method = "POST">
        Username: <input type = "text" name = "username"><br/>
        Password: <input type = "password" name = "password"><br/>
    </form>
</body>
</html>
millimoose
  • 39,073
  • 9
  • 82
  • 134
user962206
  • 15,637
  • 61
  • 177
  • 270
  • 1
    Wild guess: all the code examples I can find have a space between the `@` and the `include`, try adding one? Also, does the error go away when you remove the whole directive? (To make sure that's where the problem is.) It's also possible the error is actually in the included file. – millimoose Oct 07 '12 at 10:32
  • 2
    Ignore the IDE error message and try to run it. – subodh Oct 07 '12 at 11:02
  • Could you please provide head.html file because this will run file may problem with head.html. Error shows that "Not able to parse file" – Nishant Solanki Oct 08 '12 at 07:15
  • 1
    Post your `head.html` here. It seems that you've missed any `closing tag` in `head.html`. – sohel khalifa Oct 16 '12 at 06:56
  • along with the comment by @subodh I have found that sometimes Eclipse (if you are using it) get's believes an error is created while you are typing in a legitimate include/link (css)/or script file tag. I have had luck closing and reopening Eclipse. – Queso Jul 09 '13 at 19:54

7 Answers7

65

Select All, Backspace,Then ctrl+z to revert. works for me. But someone who knows eclipse well might shed some light as to why this happens

Anurag Priyadarshi
  • 1,113
  • 9
  • 17
11

This seems crazy but press ctrl + A,ctrl + x,paste and save the code,Bug is cleared

Jaichander
  • 812
  • 2
  • 15
  • 24
3

Also, closing the document and opening it again appears to work (please remember to save the document first).

Mindsect Team
  • 2,311
  • 5
  • 29
  • 36
1

i try Anurag Priyadarshi answer but it didnt work. But i get rid of that error by restart the eclipse, u might wanna try it it works for me. :)

idzi
  • 65
  • 7
1

Save same code in new file by deleting the error file does worked for me.

Ajay Takur
  • 6,079
  • 5
  • 39
  • 55
0

Try giving a space after @.

<%@ include file="includes/head.html" %>.

Also if head.html is in other directory then absolute path should start with / or .. Try <%@ include file="/includes/head.html" %> or

<%@ include file="../includes/head.html" %>.
Abhishek kumar
  • 2,586
  • 5
  • 32
  • 38
0

Restarting eclipse worked for me.

Anand
  • 823
  • 1
  • 10
  • 19