This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing a bean property to a custom tag using JSTL

 
david allen
Ranch Hand
Posts: 185
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI all,
Within a jsp page I am currently using a bean, a custom tag and jstl.

My bean is being accessed by jstl and a String property of the bean is being passed to my custom tag. However, the value that is actually being passed to the custom tag is
<c ut value=�${bean.name}� /> and not the value of bean.name.

I thought by the time the custom tag was executed the <c ut value=�${bean.name}� /> would have printed out the value of bean.name.

Can someone please let me know how to get the value of bean.name to the custom tag as a property.

Thank you

david
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
set the bean in the pageContext to have it available to the JSP.
The pageContext effectively means the session or request (or make it global, yugh).
 
david allen
Ranch Hand
Posts: 185
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply.
Is there any chance you can give me an example.

Thank you david
 
M. Gagnon
Ranch Hand
Posts: 68
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by david allen:

. . . the value that is actually being passed to the custom tag is
<c ut value=�${bean.name}� /> and not the value of bean.name.



I see you're using ${bean.name} in the JSTL <cout> tag value parameter. Are you using the same thing in your custom tag? For example:

<myLib:myTag myParam="${bean.name}" />
 
david allen
Ranch Hand
Posts: 185
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gagnon,

that is exactly what I am using. The example you provided is the same syntax that I have.

What am I doing wrong?

Thank you
David
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic