Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validation problem with JSP and Eclipse

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>
like image 435
Luke Avatar asked Feb 28 '09 05:02

Luke


People also ask

Why JSP file is not opening in eclipse?

Go to Window-> Preferences -> General-> Editors-> File Associations. In the File Types pane, choose *. jsp and in the associated editors pane, set your default JSP editor..

Does Eclipse support JSP?

Eclipse Enterprise Java and Web Developer Tools Enables Enterprise Java Bean, Java Enterprise Application, Fragments, and Connector, Java Web Application, JavaServer Faces (JSF), Java Server Pages (JSP), Java Servlet, Java Web Services, and Tag ...

How do I validate in eclipse?

To validate an CloudFormation template in Eclipse Perform either one of the following actions: Right-click the template name in the Package Explorer view and click Validate on the context menu. Right-click the template that you are editing in the editor pane and click Validate on the context menu.

What is JSP validation?

Overview of WebLogic JSP Form Validation TagsVerify that required fields have been filled in ( Required Field Validator class). Validate the text in the field against a regular expression ( Regular Expression Validator class). Compare two fields in the form ( Compare Validator class).


1 Answers

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)

like image 145
VonC Avatar answered Oct 08 '22 12:10

VonC