Validation problem with JSP and Eclipse

16,553

It's an oddity of the DOM validation that happens in the editor even for JSP files, reported in bug 248963 for another situation.
It's expected to be resolved in WTP 3.0.4 & Ganymede SR2.

So what eclipse and WTP version are you using ?

Can you check if this is still the case when you add the following line just beneath the initial jsp declaration:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
  "http://www.w3.org/TR/html4/loose.dtd">

as mentioned in bug 257258 (also fixed in WTP 3.0.4 & Ganymede SR2): before WTP3.0.4, this doctype was enough to not show your warning:

alt text
(source: eclipsetotale.com)

Share:
16,553

Related videos on Youtube

Luke
Author by

Luke

Updated on June 04, 2022

Comments

  • Luke
    Luke almost 2 years

    I have this simple JSP page in Eclipse and the first line in the file is:

    Eclipse however, puts a yellow warning icon before this line with the following tooltip message:

    Multiple annotations found at this line:
    - Line breakpoint:index.jsp [line: 1]
    - Tag (jsp:directive.page) should be an empty-element tag.

    Does anyone know why this is?

    UPDATE:

    This is my full source script. This is basically the template that Eclipse generates for me when I create a new JSP file based on the XHTML template. I only slightly modified the content to make it do something 'use full'.

    I'm using Eclipse 3.4 (eclipse-jee-ganymede-SR1-linux-gtk.tar.gz) on Ubuntu 8.10 with the Geronimo 2.1 plug-in (I don't think that matters though). I had this same problem with every version of Eclipse I've used so far (3.0 and up)

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <jsp:useBean id="datetime" class="java.util.Date" />
    <html>
        <head>
            <title>Hello Geronimo</title>
    
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        </head>
        <body>
            <div>
                <h1>Hello Apache Geronimo!!!</h1>on ${datetime}
            </div>
        </body>
    </html>
    
    • VonC
      VonC about 15 years
      Right, but does a DOCTYPE with XHTML 4.01 is enough to make that warning disappear ?
    • Luke
      Luke about 15 years
      Yes. it makes the warning go away. However, I didn't know there was such thing as XHTML 4.01... I've also upgraded to the latest version of Eclipse. That also did the trick. Thanks!
  • Luke
    Luke about 15 years
    I've updated my question with more info. Thanks for your response.
  • Luke
    Luke about 15 years
    By the way, your DOCTYPE solves the problem but I do not use Transitional (X)HTML. Ever :)
  • VonC
    VonC about 15 years
    All right! But that means a more recent eclipse3.4 should be able to fix this (not forcing you the change the DOCTYPE)