Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Attribute value syntax using taglib

 
Ranch Hand
Posts: 413
  • 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
 
sharp shooter, and author
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
 
Ranch Hand
Posts: 5390
1
Spring Java
  • 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
 
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: 5390
1
Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
knock knock ... any moderator or Guru ??
 
Simon Brown
sharp shooter, and author
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: 5390
1
Spring Java
  • 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
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: 5390
1
Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks again !!
 
Quick! Before anybody notices! Cover it up with this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic