Christopher Lenz wrote:
> Erik Hatcher wrote:
>
>> I also use XDoclet to generate a starter JSP and
>> ApplicationResouces.properties pieces from a form bean. This
>> particular generation is custom to our environment, but its easy to do
>> and is working very nicely.
>
>
> This sounds interesting... could you provide some more info on what the
> generated ApplicationResources.properties looks like (ie what keys are
> being added etc.), and what exactly you mean with "starter JSP"?
The way our team develops is by creating the form bean first. It
extends (indirectly) from ValidatorForm. We then have an XDoclet
process we run if we want to generate a JSP page and the necessary
resource keys. It uses XDoclet and walks all the form fields. Suppose
the form bean says this:
/**
* @struts.form name="SomeForm"
*/
public class SomeForm extends ValidatorForm {
//...
/**
* @struts.validator type="required"
*/
public void setSomeField (String someField) {
// ...
}
}
It would generate SomeForm.jsp with stuff like this:
<tr>
<th><bean:message key="SomeForm.someField"/></th>
<td><html:text property="someField"/></td>
</tr>
And then a small properties file like this:
SomeForm.someField=Some Field
There is some tricks to make the description more readable by putting
whitespace where words break with capitalization changes. We simply
copy SomeForm.jsp to whatever our real JSP filename should be into the
right place and then paste in the generated keys into the production
ApplicationResources.properties. That is passive generation - we only
do it once and then tweak the JSP from there on out and do not
regenerate the same form again unless we desire to wipe out whatever
changes we've made to the JSP.
Using the @struts.form tag and @struts.validator tags we also generate
the form bean definitions in struts-config.xml and validation.xml for
Validator.
Erik
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>