Oh, one thing I forgot to mention.

Not sure if we overlooked it, but I was wondering how are you handling
special (XML/HTML) character data?  Especially for Struts (errors.header and
errors.footer)

One peice of functionality that I am adding will (for the most part) take
care of that in a clean (IMHO) way.


Here's a snip from my sample app (ok, Craig's app, but my changes)

ApplicationResources.xml
------------------------
<root>
        <!--
              This file demonstrates how you might use the XMLMessageResources
within
              the cannonocial struts-example webapp.

              -->
        <app:mode en=""/>
        <property:html name="html.li.begin"       en="li"/>
        <property:html name="html.li.end"         en="/li"/>
        <property:html name="html.ul.begin"       en="ul"/>
        <property:html name="html.ul.end"         en="/ul"/>
        <property:html name="html.hr"             en="hr"/>
        <property:html name="html.h3.begin"       en="h3"/>
        <property:html name="html.h3.end"         en="/h3"/>
        <property:html name="html.font.red.begin" en="font color='red'"/>
        <property:html name="html.font.end"       en="/font"/>

        <button>
                <cancel en="Cancel"/>
                <confirm en="Confirm"/>
                <reset en="Reset"/>
                <save en="Save"/>
        </button>
        <change>
                <message en="Your password has expired.  Please ask the system
administrator to change it."/>
                <try en="Try Again"/>
                <title en="Password Has Expired"/>
        </change>
        <database>
                <load en="Cannot load database from {0}"/>
        </database>



        <error>
                <database>
                        <missing en="${html.li.begin}User database is missing, cannot 
validate
logon credentials${html.li.end}"/>
                </database>

-----------------------------------------------

1. en does not necessarily have to be the attribute name
   And if using separate files (by locale), then I would use val="" or
value=""
   or some other meaninful attribute.
2. The app:mode and html:property are special tags reserved for processing.
3. Notice the ${replace-able.keys} within the attribute values.
   This has the same effect as Ant properties, but it works with any
   attribute's key-value (not just html:property) which is done after
   initial loading.  It will recursively replace these tokens unless an
   infinite loop is detected.


Anyway, that's some food for thought.



James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to