- This topic has 4 replies, 4 voices, and was last updated 20 years, 11 months ago by support-michael.
-
AuthorPosts
-
Perj74MemberI have purchased MyEclipse using the Version 2.7 Release Candidate 1.
It have problems accepting the following type of tags.
<html:text property=”<%=”customerLocation[” + request.getAttribute(“rowindex”) + “].name”%>” styleClass=”input180″/>
The following error “expected %>”
Thanks Per J
support-michaelKeymasterI ran a quick test and noticed that if I use single quotes around the attribute value there is no error, e.g., property='<%=…%>’ I’ve also entered this into our issue tracking system for further research.
Michael
MyEclipse Support
Riyad KallaMemberyes I saw this too in my apps, you can also escape (weird) your quotes that are inside of the scriplets, this seems strange to me because everything inside the scriplet is actual Java code… in which case you woul dnever do the following in a Java class:
System.out.println(\”Hello World\”);
But that makes ME happy for now, I’m just curious why the compiler thinks its ok, because doesn’t it get converted into code similar to my line above? In which case its invalid Java…
Scott AndersonParticipant<html:text property=”<%=”customerLocation[” + request.getAttribute(“rowindex”) + “].name”%>” styleClass=”input180″/>
OK, I have to admit that when I look at this it takes me a good while to see what is intended. For example, how do you know if the ‘”; before customerLocation is intended as an opening (nested) or closing quote? The situation gets much easier if you use single quotes instead of double around the whole attribute value as Michael suggested. Then the whole thing suddenly makes sense, even to a human like me.
–Scott
MyEclipse Support
support-michaelKeymasterWe had a fun discussion on this one. Here’s what the JSP 1.2 spec has to say about Quoting (section 2.6):
Quoting in Attributes
Quotation is done consistently regardless of whether the attribute value is a
literal or a request-time attribute expression. Quoting can be used in attribute
values regardless of whether they are delimited using single or double quotes. It is
only required as described below.
A ‘ is quoted as \’. This is required within a single quote-delimited attribute
value.
A “ is quoted as \”. This is required within a double quote-delimited attribute
value.
A \ is quoted as \\
…
The following line shows an illegal attribute values.
• <mytags:tag value=”<%= “hi!” %>” />Thus the reason that my resolution to use single quoted attribute resolved the situation. So if you wish to keep the double quoted attribute then you must escape the internal quotes.
Michael
MyEclipse Support -
AuthorPosts