File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Passing a bean property to a custom tag using JSTL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Passing a bean property to a custom tag using JSTL" Watch "Passing a bean property to a custom tag using JSTL" New topic
Author

Passing a bean property to a custom tag using JSTL

david allen
Ranch Hand

Joined: Sep 27, 2002
Posts: 185
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

Joined: Oct 12, 2000
Posts: 5093
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).


42
david allen
Ranch Hand

Joined: Sep 27, 2002
Posts: 185
Thank you for your reply.
Is there any chance you can give me an example.

Thank you david
M. Gagnon
Ranch Hand

Joined: Feb 18, 2004
Posts: 68
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

Joined: Sep 27, 2002
Posts: 185
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
 
subject: Passing a bean property to a custom tag using JSTL
 
Similar Threads
Two value to be passed in select
HFSJ Mock question On page 487
HFS page 487, question 6
I need a JSTL equivalent for a Struts tag
JSTL forEach tag in struts problem