<!-- --><style type="text/css">@import url(https://www.blogger.com/static/v1/v-css/navbar/3334278262-classic.css); div.b-mobile {display:none;} </style> </head><body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d7256432\x26blogName\x3dThe+Frustrated+Programmer\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLACK\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://frustratedprogrammer.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://frustratedprogrammer.blogspot.com/\x26vt\x3d5012862196962223429', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>
| Tuesday, June 29, 2004

These are two different things in struts. Kinda silly really...

Here's the I write jsp code for a form (yes, I'm still not fully converted to CSS, hopefully in the next web app):

<tr>
<td class="reqlabel">*Name</td>
<td class="input"><html:text property="name"/></td>
</tr>


The problem is, in my validation.xml I also have this:

<form name="NameForm">
<field property="name" depends="required">
<msg name="mask" key="Name" resource="false"/>
</field>
</form>


This violates DRY (Don't Repeat Yourself) since both the fact that its required and the label/resource key are duplicated. Ideally the label could be built dynamically from the information in the validation.xml. For example:
-required - Make it bold with a star in front of the label.
-date/phone/etc - Append a format template to the label, e.g. Birthdate (MM/dd/yy):

Suggestions?