incorrect jsp parsing
hi.
I am getting, what seems to be incorrect parsing from IDEA on the following line of code in a jsp:
"/>]]>
The problem is with the "<%=. The parser interprets the <%= as the beginning of an expression so when it gets to the \"ECAP\" IDEA higlights an invalid escape sequence. Which is not true.
This construct is part of a taglib, that is used throughout our project and is completely valid!
Any one encounter this before?
Florian Hehlen
comj
Please sign in to leave a comment.
Hi!
FH> The problem is with the "<%=. The parser interprets the <%= as the
FH> beginning of an expression so when it gets to the \"ECAP\" IDEA
FH> higlights an invalid escape sequence. Which is not true.
Sorry, but your code is invalid. You must use:
"ECAP", but not \"ECAP\"
Thanks!
Alexey Efimov - Java Developer
Tops BI
http://www.topsbi.com
> Sorry, but your code is invalid. You must use:
> "ECAP", but not \"ECAP\"
>
well... you should tell that to my jsp compiler :) cause it compiles and runs. Without the back-slashes the jsp does not even compile...
You need to take a close look at the code cause its jsp code generating jsp... which is why the IDEA parser is confused.
Florian
Hello!
FH> well... you should tell that to my jsp compiler :) cause it
FH> compiles and runs. Without the back-slashes the jsp does not even
FH> compile...
Very strange, becouse scriplet is pure java code... That JSP engine you
using?
Alexey Efimov - Java Developer
Tops BI
http://www.topsbi.com
To avoid the issue altogether, wouldn't it be best to use single quotes in
your tag like this:
"Florian Hehlen" <florian.hehlen@ubsw.com> wrote in message
news:24593662.1083230908714.JavaMail.itn@is.intellij.net...
>
following line of code in a jsp:
>
>
beginning of an expression so when it gets to the \"ECAP\" IDEA higlights an
invalid escape sequence. Which is not true.
>
and is completely valid!
>
>
>
As you say, it's pure java, so ...
"<%=hasPlans.containsKey("ECAP")%>"
...cannot be a vailid string. it has to be:
"<%=hasPlans.containsKey(\"ECAP\")%>"
...including the 2 '\'
these jsp's are used with WebSphere 4
Florian
I believe that Alexey is correct;
The content of the scriptlet is pure java code, not including the tags:
hasPlans.containsKey("ECAP")
is valid java code, while
hasPlans.containsKey(\"ECAP\")
is not.
"Florian Hehlen" <florian.hehlen@ubsw.com> wrote in message
news:5435432.1083243665164.JavaMail.itn@is.intellij.net...
>
>
>
>
>
>
>
I agree about the use of single quotes as a solution...
Although I am still left with a lot of code that compiles and IDEA that reports it as incorrect! I can't even turn that type of highlighting off...
What I wonder now is if this is a problem with WebSphere or with the JSP spec... will have to see if I can test one of those jsp's in an other environment.
Florian
Hello, Florian!
You wrote on Thu, 29 Apr 2004 17:01:05 +0400 (MSD):
FH> ..cannot be a vailid string. it has to be:
FH> "<%=hasPlans.containsKey(\"ECAP\")%>"
FH> ..including the 2 '\'
FH> these jsp's are used with WebSphere 4
Maybe you are right... I check out our project and find similar places in
our code. But it only in taglibs.
<c:myTag myAttr="<%=\"MyValue\"%>" />
It realy compile and work, so, please, excuse me for my previous post, - it
just not very good implementation of JSP engine...
BTW, as for my Orion server, follow is euals and both work:
<c:myTag myAttr="<%=\"MyValue\"%>" />
<c:myTag myAttr="<%="MyValue"%>" />
Thanks!
Alexey Efimov - Java Developer
Tops BI
http://www.topsbi.com
So... the question now is.... should I file this one as a bug and request that the JSP parser in IDEA not highlight this as an error?
BTW I was told by an other developer here that our JSPs used to also run on JRun perfectly well with the same use of escape characters.
later... an have a good weekend,
Florian.