You are getting these values because you are printing an object instead of a String. If you supply your Linked and Micromodule objects with "toString" methods, they will be called and print the value you specify. Also, you have the option of printing a property of the object. Example:
Does that mean I add the method "toString" in my class "Linked" & "Micromodule"? like:
If so, where should I call this method? In my jsp file?
Beside, I tried to print the property of the object with the code:
Then I got the error message:
Joined: Feb 15, 2005
Every object has a toString method that prints out the object ID. Those strange looking values the printed on your page were Object IDs. What I was suggesting is that you override the toString method of your objects to print something meaningful to you. For example, the toString method of an address object might be:
If you provide a toString method, it is called automatically by Struts when you specify the object with no property in the <bean:write> tag.
The reason it didn't work when you specified a property is that you specified it incorrectly. Change your tag to
and make sure the object has a getLocalnb method. [ September 12, 2008: Message edited by: Merrill Higginson ]
Joined: May 14, 2003
Following your suggestion, I override toString method in my two classes: Linked & Micromodule and modified my jsp code to see what happended. Now my jsp code is:
And the result is :
I don't know why the values in "row" is still the strong IDs and why only in the second result we can have the values that are readable. If I add the property (localnb) to show in the jsp, then I got the same error, that means there is not getter method, however, this method does exist in my class Micromodule. After all, I went through my scripts and have following questions: 1. Basically my 2 dimension array has the type Object[Linked][Micromodule], in the jsp file, does "row" mean the content of "Linked" and "col" for "Micromodule"? 2. In side the "Linked" class, there are the fields of type of user defined, like "Kchip", "Bundles". I tried to override toString method of these two classes, when I run the application, I got the error "java.lang.StackOverflowError". Without overriding toString inside these two classes, I got the result as above. Why? Does this cause the value like "[Ljava.lang.Object;@64eff0 " in the result
Thanks a lot for your help!
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Retrieve values from Object using iterator