Dear People,

        Here at Cisco we are thinking of adopting Struts for one of our projects. 
There are however two issues we wish to address. And since Struts is an 
open source project hopefully contribute back to it. Firstly, though,  I 
would like to get your feedback.

The issues are (i) dynamic forms and (ii) hierarchical support for property 
files. The dynamic form are suggested in TODO list for 1.1. Here is a 
solution we have been toying with.

The base class ActionForm gains the following methods

        /**
        * Sets array of values for the given dynamic property.
        */
        public void set(String name, String[] values);

        /**
         * Returns the array of values for the given dynamic property.
         */
        public String[] get(String name);

        /**
        * Returns the enumeration of names of all dynamic properties.
        */
        public Enumeration names();

        /**
            * Clear all dynamic properties.
            */
           public void clear();

In addition the process how the HTML forms are encoded and how tag 
libraries fetch initial values for the forms is modified (this involves 
altering org.apache.struts.util.PropertyUtils and 
org.apache.struts.util.BeanUtils). I have implemented necessary changes and 
it works just fine. (For the background information, this is needed as we 
dynamically generate tables with check boxes that are given unique IDs of 
various objects). I would like to know if a similar effort has been 
undertaken and if so, what are suggested solutions. Also, if not, what do 
you think of this and who specifically should I talk to, rather than 
flooding the whole group with all details.

The second issue is support for hierarchy of language property files. Since 
in our project we use multiple rather than single property file (in excess 
of 20) trying to support any more than 3 languages becomes a mess. With 10+ 
languages we have in excess of 200 files in a single directory. The 
solution I'd like to see in Struts would be as follows. Rather than 
appending locale suffixes, these are used to access sub-directories. 
Suppose that we are asked to load a property file foo from a directory bar. 
If the locale is xx_YY rather than looking for bar/foo_xx_YY.properties, 
bar/foo_xx.properties and bar/foo.properties we look for 
bar/xx/YY/foo.properties, bar/xx/foo.properties and finally for 
bar/foo.properties. Notice that in this solution we look in the same 
location for the default file as in the one that is currently implemented 
in Struts. However rather than having ten or so different versions of a 
property file in the same directory they are located in sub-directories 
corresponding to their languages. Again, I have it implemented and it works 
just fine. If nobody opposes I am happy to contribute the code back to the 
project.

Please let me know what are your thoughts and how should I proceed to have 
those changed added to Stuts.

Regards ... Bo

Reply via email to