• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

assigning attribute values for custom tags

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Does it matter whether you use single quotes [']
or double quotes["] when assigning attribute values
within a custom tag.

In HFSJ, p.471 examples are given using both, e.g.

<mine:advice user="${userName}" />

and

<mine:advice user='<%= request.getAttribute("username") %>' />

Thanks
 
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes it does matter
In case I: <mine:advice user="${userName}" />
It will not matter, but
In Case II: <mine:advice user='<%= request.getAttribute("username") %>' />
It would matter

Because in this case if you use
<mine:advice user="<%= request.getAttribute("username") %>" />
the compile would not know that for which is the starting " & which is the ending ", so in such cases, you need to use certain delimiters like for exam, for using "" you might do something like\

<mine:advice user="<%= request.getAttribute(\"username\") %>" />

shashank
 
reply
    Bookmark Topic Watch Topic
  • New Topic