Bug 152620 - [validation] [content model] "missing end tag" : WTP seems validate HTML and JSP tags at the same level
Summary: [validation] [content model] "missing end tag" : WTP seems validate HTML and ...
Status: NEW
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: 1.5   Edit
Hardware: PC Windows 2000
: P2 normal with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: jst.jsp CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard:
Keywords: helpwanted
: 152102 154858 158325 159067 167030 272701 352048 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-08-02 12:29 EDT by Patric Rufflar CLA
Modified: 2013-07-18 14:26 EDT (History)
11 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patric Rufflar CLA 2006-08-02 12:29:55 EDT
Hello,

WTP seems to validate the HTML tags and JSP tags balance at the same level.
Consequential it can happen that WTP wrongly thinks that tags are unbalanced.

You can reproduce it, using WTP 1.5.0 and create a new jsp, and paste the following:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<form>
<jsp:forward page="">
</form>
</jsp:forward>
</body>
</html>

Line 7 will be marked as an error "Missing end tag jsp:forward". However, this code is valid.
jsp:forward can be substituted by any other tag.

Best Regards,
Patric
Comment 1 Amy Wu CLA 2006-08-09 14:39:08 EDT
FYI, I think this bug may warrant a note in documentation.  See bug 153330.
Comment 2 Amy Wu CLA 2006-08-23 14:22:50 EDT
*** Bug 154858 has been marked as a duplicate of this bug. ***
Comment 3 Amy Wu CLA 2006-09-28 10:16:15 EDT
*** Bug 159067 has been marked as a duplicate of this bug. ***
Comment 4 Amy Wu CLA 2006-12-22 15:20:41 EST
*** Bug 167030 has been marked as a duplicate of this bug. ***
Comment 5 Bob Gallagher CLA 2010-01-13 16:08:25 EST
*** Bug 158325 has been marked as a duplicate of this bug. ***
Comment 6 Ian Tewksbury CLA 2010-01-20 11:12:47 EST
This is still an issue that should be investigated.
Comment 7 Nick Sandonato CLA 2010-04-26 17:42:29 EDT
The challenging part of this is knowing where things get paired up, and if they get paired up (in the case of conditional tags like <c:when>).
Comment 8 Nick Sandonato CLA 2010-10-05 18:08:19 EDT
*** Bug 272701 has been marked as a duplicate of this bug. ***
Comment 9 Nick Sandonato CLA 2011-07-14 10:56:59 EDT
*** Bug 352048 has been marked as a duplicate of this bug. ***
Comment 10 SChan CLA 2011-09-21 22:31:48 EDT
Hi, Nick Sandonato, this is not just about pairing. It's not as simple as that. 

It's really about "Levels". Each level of parsing must be done separately in order. Take a look of this simple example:

<p title="<s:property value="foo.bar"/>">
The quick brown fox jumps over the lazy dog
</p>

For simple xml parsing, this is invalid, because a tag is not allowed to appear in the attribute of another tag. 

However, this is acceptable for jsp syntax, because all it cares is the <s:property value="foo.bar"/> part. The rest to jsp (<p title...) is just text/string regardless it is valid xml or not. 

If Eclipse wants to do parsing/colour coding/validating correctly for human users and supports both jsp level and xml/html levels, it has got to treat them separately. 

If one clever engineer may think they can still do a one-level parsing with the above example, then take a look at this crazier example (but runs well on server):

<div
<s:if test="foo.bar">
>
The quick brown fox jumps over the lazy dog
</div>
</s:if>
<s:else>
class="clear"/>
</s:else>

Although this looks bad and I don't suggest anyone to follow this in practice, without parsing one level after another, I don't think any realistic practical parser can parse this correctly.
Comment 11 Nick Sandonato CLA 2011-11-14 17:21:18 EST
*** Bug 152102 has been marked as a duplicate of this bug. ***