facebook

Struts JSP tile problem [Closed]

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #200716 Reply

    Perj74
    Member

    I 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

    #200744 Reply

    support-michael
    Keymaster

    I 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

    #200754 Reply

    Riyad Kalla
    Member

    yes 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…

    #200769 Reply

    Scott Anderson
    Participant

    <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

    #200809 Reply

    support-michael
    Keymaster

    We 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

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Struts JSP tile problem [Closed]

You must be logged in to post in the forum log in