JSP-Tags inside HTML-Tags

In the latest EAP versions, the JSP files are parsed as XHTML files.
This means that all - or at least most - of our JSPs appear with many
errors in IDEA.

How do you solve the problem with "nested" tags like

checked="checked" /> where the JSP-Tag appears inside the HTML-Tag which makes IDEA complain about the element not being closed when the ]]>
starts?

Michael

15 comments
Comment actions Permalink

We are resolving this issue.

Michael Descher wrote:

In the latest EAP versions, the JSP files are parsed as XHTML files.
This means that all - or at least most - of our JSPs appear with many
errors in IDEA.

How do you solve the problem with "nested" tags like

<input type="checkbox" <c:if test="...">checked="checked"</c:if> />

where the JSP-Tag <c:if> appears inside the HTML-Tag <input> which makes
IDEA complain about the element <input> not being closed when the <c:if>
starts?

Michael



--
Maxim Mossienko
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Will this also address the multiple quote errors? For example, the following is a valid snippet:

">blah]]>

note the double quote followed by single quote in foobar

0
Comment actions Permalink

Hani Suleiman wrote:

Will this also address the multiple quote errors? For example, the following is a valid snippet:

<a href="<ww:url page="'foobar'" />">blah</a>

note the double quote followed by single quote in foobar


And what about the problem that you won't be able to use code completion
(and other related features) for the <ww:url>-Tag in the above example
because it is treated as an attribute value (a simple String)?

0
Comment actions Permalink

Hi,

Yes, we will handle this issue also.

Hani Suleiman wrote:

Will this also address the multiple quote errors? For example, the following is a valid snippet:

<a href="<ww:url page="'foobar'" />">blah</a>

note the double quote followed by single quote in foobar



--
Maxim Mossienko
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Hi,

We expect this problem to be addressed after having the parser
understands the quotes properly.

Michael Descher wrote:

Hani Suleiman wrote:

>> Will this also address the multiple quote errors? For example, the
>> following is a valid snippet:
>>
>> ">blah >> >>]]> note the double quote followed by single quote in foobar


And what about the problem that you won't be able to use code completion
(and other related features) for the <ww:url>-Tag in the above example
because it is treated as an attribute value (a simple String)?



--
Maxim Mossienko
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Yes, we will handle this issue also.


Hooray! I've just started working with WebWork, and was hoping your guys
would do this.

Tobin


0
Comment actions Permalink

I don't get your answer: you mean that you really think you can validate the html of a jsp ? What about if part of the html is generated by function calls or components, and part not ? What intellij did up to now, was to help in writing, instead of validating, which is demonstrably impossible. Seems an inpractical direction to take, and being so damn practical was the key strong feature of older intellijs.

0
Comment actions Permalink

I don't get your answer: you mean that you really
think you can validate the html of a jsp?


Yeah, that's what they're doing. Try editing a plain HTML file with the current build and you'll see this -- IDEA will (try to) validate the file for you.

And no, I don't like it either, for the same reasons you outlined above. Even if you're not dealing with JSP, standard HTML+Javascript is already complex enough to frustrate any attempt to validate the resulting file.

0
Comment actions Permalink

Well Mr. Brito,

what could we do about this ? Its really hard to swallow that they went this crazy.

Maybe the only remedy is that anyone that thinks that this is a foolish idea, starts posting!

0
Comment actions Permalink

as long as it doesn't crash/throw exceptions, and I can turn off any of the warnings the validations
emit - I don't mind having idea validate my files. Heck - it might even help me to conform to w3c
more. HECK! IT MIGHT EVEN FIND MISTAKES I HAVE OVERLOOKED! GOD WHAT A TERRIBLE FEATURE!!

;)

cheers..




Pietro Polsinelli wrote:

Well Mr. Brito,

what could we do about this ? Its really hard to swallow that they went this crazy.

Maybe the only remedy is that anyone that thinks that this is a foolish idea, starts posting

0
Comment actions Permalink

We clearly understand that our highlighting for content language is far
from perfect (it can't be perfect because of "dynamic" JSP nature) and
now considering acceptable solution. Is it good enough to let user
disable content (HTML/XML/JavaScript/etc.) highlighting for one single file?

IK

0
Comment actions Permalink

This would make jsp editing for anything that uses a framework pretty much useless!

I don't see what the problem is...why not steal the parser from tomcat and adapt it to IDEA? The parsing is not that complicated, as long as you don't treat a jsp page as being well formed, you can identify exactly what a given region is, given the taglib declarations and web.xml...

0
Comment actions Permalink

Hani, the problem we're talking about is not about the JSP parser. A few more bug fixes and this parser will be very nice, I believe.

The real problem is that IDEA is trying not only to validate your page as JSP, but also validate if the underlying content (eg, HTML) is valid. Unless this can be turned off (I'd say, unless this is off by default for JSP files) this will lead to many errors and a lot of frustration.

0
Comment actions Permalink

Ah! Right, yeah definitely don't bother validating as html (or have it trivially switch-offable)

0
Comment actions Permalink

As Joel-on-software says, adding options is not generally a good solution. Moreover if one page while valid is apparently html invalid, it is possible that that is a feature of the framework in use, and hence all pages will result html invalid. As ironically remarked above, that there is an attempt to validate is not a minus; but apparent invalidity of the html should absolutely not result in an invalid jsp (the little red ligth turning on). What it could do is mark in some way the offending tag - tags - part of code, but should not be the same mark type of invalid jsp code.

0

Please sign in to leave a comment.