Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Attribute value syntax using taglib

 
Gaurav Chikara
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have noticed that
<eg:foo att1="98.5" att2="92.3" att3="<%=hi!%>">
<li><%= member %></li>
hello world
</eg:foo>
defining att3 value in this way is acceptable
and also in following ways att3="<%=”hi!”%>",
att3='<%= "hi!" %>'
but it gives internal servlet error on att3="<%=\”hi!\”%>"
org.apache.jasper.compiler.ParseException: C:\jakarta-tomcat\webapps\examples\jsp\simpletag\foo.jsp(15,45) Attribute hi! has no value
can anyone explain the reasoning
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gaurav Chikara:
but it gives internal servlet error on att3="<%=\”hi!\”%>"
org.apache.jasper.compiler.ParseException: C:\jakarta-tomcat\webapps\examples\jsp\simpletag\foo.jsp(15,45) Attribute hi! has no value
can anyone explain the reasoning

Yes, it's because the text between the <%= %> delimiters must be a valid Java expression, the same as you would use in normal Java code or a scriptlet.
Cheers
Simon
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gaurav Chikara:

att3="<%=hi!%>">

how come this possible? as ! can not be used in variable name.
CMIW
TIA
 
Asher Tarnopolski
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"<%="hi"%>" doesn't work by me (tc4.0.3).
"<%=\"hi\"%>" and '<%="hi"%>' work fine!
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
knock knock ... any moderator or Guru ??
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What was the value of rtexprvalue set to in the TLD file?
Simon
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
let us say it is rtexprvalue is true.
still how come att3="<%= hi! %>" can work.
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this case it shouldn't work since it's not a valid Java expression.
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks again !!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic