File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Data dictionary for displaying value objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Data dictionary for displaying value objects" Watch "Data dictionary for displaying value objects" New topic

Data dictionary for displaying value objects

Carl Bradbury

Joined: Jul 24, 2003
Posts: 3
Hi all,
I'm currrently working on a project in which we are pulling a set of value objects back from a data server and displaying the attributes of these objects in a JSP. The framework I am using is Struts 1.1.
The value object's attributes are mostly custom typesafe enums (see Effective Java, Bloch, p105) that Struts doesn't have a clue how to handle, as you'd expect.
Currently I am 'wrapping' the returned objects into a composite object that contains the returned value objects and provides me with accessor methods that convert the enums into Strings for displaying.
Although this is a quick and easy fix, does anyone have any suggestions on a more flexible approach? i.e. something that doesn't require me to write one wrapper class for each set of value objects returned. I've heard mention that a data dictionary might be useful, in which I map the contents of each value object within an XML file that defines the type of each field. I could then use a generic class to handle each object according to the definitions in the dictionary.
Can anyone point me to an example of this kind of solution?
Jason Menard

Joined: Nov 09, 2000
Posts: 6450
Welcome to JavaRanch. We don't have many rules here, but one we do have is a naming policy. Please edit your display name to comply with this policy. Thanks in advance, and we look forward to seeing you around the Ranch.
[I see on the topic list on the main Saloon page that your name at one time showed up as "Carl Bradbury" and not "Nondescript".]
[ December 16, 2003: Message edited by: Jason Menard ]
I agree. Here's the link:
subject: Data dictionary for displaying value objects
jQuery in Action, 3rd edition