• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using "jsp:getProperty" action tag in custom tag attribute - Possible?

 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is it possible to use

inside a custom tag attribute?
For example, I want something like this in my JSP Page:

In the Taglib descriptor, I have set rtexprvalue to true.
Thanks in advance,
------------------
Sandeep Desai
vgdesai@bom3.vsnl.net.in

  1. Sun Certified Java Programmer Scored 93 per cent
  2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
  4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
 
Phil Hanna
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSP 1.1 spec section 2.12.1 explicitly says that a request time attribute value has to have the form "<%= expr %>" or '<%= expr %>'. Section 2.13.3 says that <jsp:getProperty> "... places the value of a Bean instance property, converted to a String, into the implicit out object, from which you can display the value as output." It doesn't say anything about it being equivalent to "<%= expr %>", so it would seem that this shouldn't work.
However, in section 5.3.5 (the tag library descriptor) where the rtexprvalue attribute is documented, it only says "... dynamically calculated at runtime by a scriptlet expression". That would seem to me to be requiring the "<%= expr %>" syntax.
So is it suppposed to work? I'd say no. Does it actually work? Depends on how the developers of your servlet engine read the spec - we'd have to construct a test and look at the generate code (assuming it gets that far).

------------------
Phil Hanna
Sun Certified Programmer for the Java 2 Platform
Author of :
JSP: The Complete Reference
Instant Java Servlets
Website: http://www.philhanna.com
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Phil,
Had tried this out!!
Unfortunately <jsp:getProperty> action tag doesnot seem to work.I think the following is the governing criteria

However, in section 5.3.5 (the tag library descriptor) where the rtexprvalue attribute is documented, it only says "... dynamically calculated at runtime by a scriptlet expression". That would seem to me to be requiring the "<%= expr %>" syntax.

Hence the only work around (which I can think off!!) is to use the getter method instead in the expression tag, like this :

Please let me know your opinion on this.
Regards,


------------------
Sandeep Desai
vgdesai@bom3.vsnl.net.in

  1. Sun Certified Java Programmer Scored 93 per cent
  2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
  4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic