Hi:

I am trying to access a bean from my JSP code. The property on the bean is
an object. I thought, reading from the spec, that the toString() method
would be called on the object I am trying to access. For instance if I had:

<jsp:useBean id="book" class="Book" scope="session" />
...
<jsp:getProperty name="book" property="author" />

would print out the author's name if I had the following classes:

public class Book
{
        public Author getAuthor()
        {
                return author;
        }
        private Author author;
}

public class Author
{
        public getName()
        {
                return name;
        }
        public toString()
        {
                return name;
        }
        private String name;
}

The spec says "The conversion to String is done as in the println() methods,
i.e. the toString() method of the object is used for Object instances, and
the primitive types are converted directly," in section 2.13.3, but this
does not seem to be the case.

If anyone has any ideas, let me know. Thanks.

Kit Cragin
VP of Product Development
Mongoose Technology, Inc.
www.mongoosetech.com


Reply via email to