Where can I find an example showing a JSP taglib attribute that takes a scriptlet expression(i.e. value is not a quoted string, but a variable evaluated at run-time)?

John Millaway

In your TLD, you must set "<font color="green" >rtexprvalue</font>" to true.

  <<font color="brown" >tag</font>>
    <<font color="brown" >tagclass</font>>mypackage.EchoTag<<font color="brown" >/tagclass</font>>
    <<font color="brown" >name</font>>echo<<font color="brown" >/name</font>>
    <<font color="brown" >attribute</font>>
       <<font color="brown" >name</font>>text<<font color="brown" >/name</font>>
       <<font color="brown" >required</font>>true<<font color="brown" >/required</font>>
       <<font color="brown" >rtexprvalue</font>>true<<font color="brown" >/rtexprvalue</font>>
    <<font color="brown" >/attribute</font>>
  <<font color="brown" >/tag</font>>
I have found that the rt attribute must be a static string, or a scriptlet, not a combination of both. In other words:
<<font color="brown" >b</font>>Good morning,<<font color="brown" >b</font>>
   <<font color="brown" >echo</font> <font color="green" >text</font>="Tom" /> Good.
   <<font color="brown" >echo</font> <font color="green" >text</font>="<font color="blue" ><%= $name %></font>" />     Good.
   <<font color="brown" >echo</font> <font color="green" >text</font>="Mr. <font color="blue" ><%= $name %></font>" /> Bad.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact