JSP: double quotes [message #140119] |
Thu, 22 September 2005 07:55  |
Eclipse User |
|
|
|
Hello,
I have quasetion about double quotes in JSP as in example:
<html:text name="myDate" property="date"
value="<%=request.getParameter("date") %>" />
In Eclipse (3.1 + WTP 0.7) there is no error, but in WSAD 5.1.0 (based
on Eclipse 2.1?) there is error like this: "JspTranslate: Attribute date
has no value". This error is not so clear, but for them, who are
familiar with WSAD error messages, they know, that WSAD claims on double
quotes. It's against JSTL 1.0 specification (the same example is
described in book
http://publib-b.boulder.ibm.com/abstracts/sg246690.html?Open , page
269-272).
On Tomcat there is no problem, but on WAS 5.0.2 it can't run.
Why WTP doesn't complain on that?
Martin
|
|
|
Re: double quotes [message #140268 is a reply to message #140119] |
Thu, 22 September 2005 11:57   |
Eclipse User |
|
|
|
Hi,
thats because you have to escape the quotes like that.
<html:text name="myDate" property="date"
value="<%=request.getParameter(\"date\") %>" />
Unfortunately WTP has a bug (104767) and you will get an error indicator
with "Syntax Error on token "Invalid Character" as message.
Klaus
"Maple" <maple@seznam.cz> schrieb im Newsbeitrag
news:dgu67q$pqp$1@news.eclipse.org...
> Hello,
>
> I have quasetion about double quotes in JSP as in example:
>
> <html:text name="myDate" property="date"
> value="<%=request.getParameter("date") %>" />
>
> In Eclipse (3.1 + WTP 0.7) there is no error, but in WSAD 5.1.0 (based
> on Eclipse 2.1?) there is error like this: "JspTranslate: Attribute date
> has no value". This error is not so clear, but for them, who are
> familiar with WSAD error messages, they know, that WSAD claims on double
> quotes. It's against JSTL 1.0 specification (the same example is
> described in book
> http://publib-b.boulder.ibm.com/abstracts/sg246690.html?Open , page
> 269-272).
>
> On Tomcat there is no problem, but on WAS 5.0.2 it can't run.
>
> Why WTP doesn't complain on that?
> Martin
|
|
|
Re: JSP: double quotes [message #140280 is a reply to message #140119] |
Thu, 22 September 2005 12:07   |
Eclipse User |
|
|
|
Originally posted by: erickson_d.yahoo.removethis.com
WTP doesn't complain because it is following the JSP2.0 spec. WSAD is
complaining because it is following the JSP1.2 spec. They differ on
this issue.
The relevant grammar is found on page 1-26 of JSP2.0
RTAttributeValueDouble::=
((QuotedChar - '"' )* - ((QuotedChar - '"')* '%>'))
( '%>"' | <TRANSLATION_ERROR> )
The JSP2.0 grammar says, in English: if the attribute value of a custom
action starts with <%= it must end with %> and any matching quote
symbols in between are ignored.
On the other hand, JSP1.2 doesn't have a formal grammar, but page 41
shows an example with the same form you asked about and says it's illegal.
Decide what JSP version you will use, then pick a servlet engine that
supports it. Tomcat 5 or greater supports JSP2.0. I highly recommend
JSP2.0 for its EL and tag files -- often overlooked gems without which
JSP development is abominable.
Hope that helps,
Doug
Maple wrote:
> Hello,
>
> I have quasetion about double quotes in JSP as in example:
>
> <html:text name="myDate" property="date"
> value="<%=request.getParameter("date") %>" />
>
> In Eclipse (3.1 + WTP 0.7) there is no error, but in WSAD 5.1.0 (based
> on Eclipse 2.1?) there is error like this: "JspTranslate: Attribute date
> has no value". This error is not so clear, but for them, who are
> familiar with WSAD error messages, they know, that WSAD claims on double
> quotes. It's against JSTL 1.0 specification (the same example is
> described in book
> http://publib-b.boulder.ibm.com/abstracts/sg246690.html?Open , page
> 269-272).
>
> On Tomcat there is no problem, but on WAS 5.0.2 it can't run.
>
> Why WTP doesn't complain on that?
> Martin
|
|
|
Re: JSP: double quotes [message #140293 is a reply to message #140280] |
Thu, 22 September 2005 12:28   |
Eclipse User |
|
|
|
Originally posted by: erickson_d.yahoo.removethis.com
Hmm. Let me retract that. I misread the JSP2.0 grammar. It does say
that any matching quotes inside the scriptlet must be quoted with a
backslash. I guess this is a bug in WTP and Tomcat.
Sorry for the confusion!
Doug Erickson wrote:
> WTP doesn't complain because it is following the JSP2.0 spec. WSAD is
> complaining because it is following the JSP1.2 spec. They differ on
> this issue.
>
> The relevant grammar is found on page 1-26 of JSP2.0
>
> RTAttributeValueDouble::=
> ((QuotedChar - '"' )* - ((QuotedChar - '"')* '%>'))
> ( '%>"' | <TRANSLATION_ERROR> )
>
> The JSP2.0 grammar says, in English: if the attribute value of a custom
> action starts with <%= it must end with %> and any matching quote
> symbols in between are ignored.
>
> On the other hand, JSP1.2 doesn't have a formal grammar, but page 41
> shows an example with the same form you asked about and says it's illegal.
>
> Decide what JSP version you will use, then pick a servlet engine that
> supports it. Tomcat 5 or greater supports JSP2.0. I highly recommend
> JSP2.0 for its EL and tag files -- often overlooked gems without which
> JSP development is abominable.
>
> Hope that helps,
>
> Doug
>
> Maple wrote:
>
>> Hello,
>>
>> I have quasetion about double quotes in JSP as in example:
>>
>> <html:text name="myDate" property="date"
>> value="<%=request.getParameter("date") %>" />
>>
>> In Eclipse (3.1 + WTP 0.7) there is no error, but in WSAD 5.1.0 (based
>> on Eclipse 2.1?) there is error like this: "JspTranslate: Attribute
>> date has no value". This error is not so clear, but for them, who are
>> familiar with WSAD error messages, they know, that WSAD claims on
>> double quotes. It's against JSTL 1.0 specification (the same example
>> is described in book
>> http://publib-b.boulder.ibm.com/abstracts/sg246690.html?Open , page
>> 269-272).
>>
>> On Tomcat there is no problem, but on WAS 5.0.2 it can't run.
>>
>> Why WTP doesn't complain on that?
>> Martin
|
|
|
Re: double quotes [message #140326 is a reply to message #140268] |
Fri, 23 September 2005 02:00  |
Eclipse User |
|
|
|
> thats because you have to escape the quotes like that.
> <html:text name="myDate" property="date"
> value="<%=request.getParameter(\"date\") %>" />
>
> Unfortunately WTP has a bug (104767) and you will get an error indicator
> with "Syntax Error on token "Invalid Character" as message.
Better this error than no error (in this case :-). But in my WTP (0.7) I
can't see no message like "syntax error on token..." WTP doesn't
complain on this.
Martin
|
|
|
Powered by
FUDForum. Page generated in 0.25314 seconds