Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What's rtexprvalue=false good for?

 
john gunther
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know why anyone would ever want to set this to anything other than true. Basically, if it is false (the default) I cannot set the attribute to anything other than "a static value known at compile time". Why would
such a restriction be a good thing? Can someone give an example where false works better than/is a better choice than/ true for this?

Note: these tags occur within tag library descriptor files, here is a snippet:

<tag>
...
<attribute>
<name>a</name>
<required>yes</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
...
</tag>


John
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John,

It depends what is likely to be required. You may only restrict the value to
be assigned that is static and not dynamic(run time).

<rtexprvalue>=true means, it can be String literal or an expression that
results value to be assigned.


Thanks,
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the translation engine knows that an attribute value is going to be a static string there are certain optimizations it can take. The exact steps are container-specific as long as they comply with the specification. Also for such attributes, TEI translation-time validation can take place. I imagine that this is why the JSTL tags set trexprvalue to false for their var and scope attributes.
 
Mahboob Ali
Greenhorn
Posts: 3
AngularJS Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if we use <rtexprvalue>false</rtexprvalue>
then it restrict the jsp engine don't allow expression language while taking attribute like as follows
eg:http://localhost:8080/scwcd5n/test.jsp?uname=Mahboob Ali
<mine:mytag wish="${param.uname}"> then we will get following exception saying
org.apache.jasper.JasperException: /test.jsp (line: 7, column: 0) According to TLD or attribute directive in tag file, attribute wish does not accept any expressions
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic