• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

assigning attribute values for custom tags

 
mo sayed
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • 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
 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic