This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes A(nother) problem with beans. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "A(nother) problem with beans." Watch "A(nother) problem with beans." New topic
Author

A(nother) problem with beans.

Richard Scothern
Ranch Hand

Joined: May 25, 2001
Posts: 83
Hi everyone,
Before I present my next problem, I'd just like to thank those who have helped in the past.
Now, I am using a bean in a jsp page, the values of which were previously set in a servlet.
One of the variables in the bean holds a reference to a BufferedReader object. I'd like to pass this reference to a custom tag.
The custom tag has been set up correctly, and has the necessary setXxx() attribute. However, when I try to set this attribute with <jsp:getProperty> I get an exception saying it can't convert from type String to type java.io.BufferedReader. So I assume that the value from the bean is being returned as a String representation. How can I pass the reference to the custom tag without doing this?
Cheers,
Richard
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
jsp:getProperty> I get an exception saying it can't convert from type String
Get property almost always(?) returns String.

to type java.io.BufferedReader. So I assume that the value from the bean is being returned as a String representation. How can I pass the reference to the custom tag without doing this?
To get the BufferedReader object, you must use getAttribute() method on the implicit object on which it is present (application|session|request|page) and then cast it to a BufferedReader.
regds.
- satya


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
 
 
subject: A(nother) problem with beans.
 
Similar Threads
obtaining the JSP Tag Attributes from a bean
Retreiving objects from a bean
Passing bundled resource as attribute to panel tag
Custom Struts Tag
Setting variables from tagfiles with "var-from-attribute"