Firstly, our system is going to have a quite a few drop down objects and we need to know the most efficient way of filling those lists. Should we hard code the drop downs in the XSL file or should be store them in XML files? We want to stay away from storing all these values in the database to avoid round trips to the server and ultimately using up more resources. We want to keep it at the middle tier.
For drop down lists, I suggest storing them as hardcoded values in the XSL if you don't expect these values to change frequently. When they do, you can simply edit the stylesheet to accommodate the changes. Since XSL supports file imports, you can include any number of stylesheets in another stylesheet. To keep your design modular, define entity-based stylesheets or subsystem based stylesheets. For instance, you can put all the dropdown lists in one stylesheet and call it "dropdownlists.xsl". Then you can simply import this in any other stylesheet that needs to display one or more dropdown lists by using < xsl:import href="dropdownlists.xsl"/ >
The dropdownlists.xsl will have < xsl:template match = > constructs for all different dropdown list widgets. Since
< template match > is performed from the current stylesheet in a bottom-up fashion, you can even "override" some definitions if need be. We currently use this approach and this results in a very clean and easy to maintain design. No more 2000 line xsl files!
Secondly, we are also going to be using several multi-select objects throughout our system. We were thinking of using a similar control that alot of wizards use... Two list boxes with the ability to move items to and from those boxes. However, we are confused on how we should store those multi-selects in our database. How does one go about this?
This is slightly off the XML track, but I'll chime in anyway. You could store them in a two column table as name,value pair where the name identifies the entity name( the listbox name ) and the values are the listbox contents. If you don't have a significantly large number of such listboxes, you may want to consider storing them in an XML file and using a parser to fetch the values. The cost of maintaining a database schema and using a
JDBC layer to connect and fetch data may not be justified if your dataset is fairly small. The decision about the storage media should really be driven by the requirements - size of data, whether you need lookup/search facilities, frequency of change etc.
Finally, are there any advantages to having multiple packages within one system or project?
Well, I am totally lost here
. Are you talking about organizing your Java classes in different packages? If so, using packages promote modularity and cleaner design. Although you may have a fewer classes to begin with, as the project development progresses, you will start adding more and more program modules( groups of classes that interact with each other ). It makes sense to organize the sourcecode based on some schema - subsystem(Inventory,Ordering,Customer etc ) or classtype(Servlet/SessionBeans/EntityBeans/Utilities etc ) etc. Again, since this is off the XML track, you may want to post this question in other Java-related forums here at the Ranch for a better answer.
Cheers!
------------------
Ajith Kallambella M. Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
Co-author of
Java 2 Certification Passport