struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Husted" <hus...@apache.org>
Subject Re: [s2] Validation
Date Wed, 02 Aug 2006 16:21:41 GMT
On 8/2/06, Patrick Lightbody <forum-struts-dev@opensymphony.com> wrote:
> Perhaps the best thing to do to address these little issues is to mock out what an
>ideal webapp would look like using ideal configurations/annotations.

I'm trying to do that now with the MailReader application, but I'm
running into wildcard issues :(

Film at 11.

One notion would be the idea of using a combined
mapping/validation/message configuration as a "code-behind", and then
offering the same utilty via annotations.

So, for a given Action class, we might have a single XML, along the lines of

<struts>
<package name="Registration.Retrieve" namespace="/Registration"
extends="MailreaderSupport">
<action name="Retrieve" class="mailreader2.Registration.Retrieve">
    <result name="input">/pages/Registration.jsp</result>
    <result type="redirect-action">MainMenu</result>
    <interceptor-ref name="guest"/>
</action>
</package>

<validators>
    <field name="username">
        <field-validator type="requiredstring">
            <message key="error.username.required"/>
        </field-validator>
    </field>
    <field name="password">
        <field-validator type="requiredstring">
            <message key="error.password.required"/>
        </field-validator>
    </field>
</validators>

<messages>
  <locale name="en">
   <key>error.username.required</key>
   <text>User Name is required</key>
   <key>error.password.required</key>
<   text>Password is required</key>
</locale>
</messages>

</struts>

Which would not necessarily obviate have separate -validation,
-action, and -message files, if desired.

-Ted.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message