Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tag lib question - urgent

 
Ernest Lee
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<a:text value="<a:value attribute="attr1"/>"/>
it is possible to have the value output by a:value tag to be used by a:text tag at all??
or we will have to have something like
<a:text>
<value="<a:value attribute="attr1"/>
</a:text>
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
..... have you tried it?
 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct me if I am wrong, but I was under the impression that a value for an attribute can only be set to a scriptlet expression or a static(literal) value.
craig
 
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 cj jack:
Correct me if I am wrong, but I was under the impression that a value for an attribute can only be set to a scriptlet expression or a static(literal) value.

That's right - a literal value or a JSP runtime expression, although with the JSTL and JSP 2.0 you can use the included "expression language".
In answer to the original question, you can't have the result/evaluation of a tag as an attribute to another - this would effectively require a two stage translation of the page, and there's nothing to say that a tag will actually generate any content. To specify complex values, you can either use a JSP runtime expression (<%= ... %> ) or nest the tags as follows:
<a:text>
  <a:value attribute="attr1"/>
</a:text>
There are several ways of making this type of thing work - (1) have the <a:value> tag pass the data to it's parent, or (2) make <a:text> a BodyTag, have <a:value> generate some content and read this generated body content in the doEndTag() method of the <a:text> tag handler.
Hope that helps...
Simon
[ June 24, 2002: Message edited by: Simon Brown ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic