struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf Hauser (JIRA)" <j...@apache.org>
Subject [jira] Commented: (STR-1955) [validator] automate maxlength validations
Date Wed, 14 Mar 2007 13:09:51 GMT

    [ https://issues.apache.org/struts/browse/STR-1955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40554
] 

Ralf Hauser commented on STR-1955:
----------------------------------

see also STR-1705 and http://issues.apache.org/bugzilla/show_bug.cgi?id=36351

> [validator] automate maxlength validations
> ------------------------------------------
>
>                 Key: STR-1955
>                 URL: https://issues.apache.org/struts/browse/STR-1955
>             Project: Struts 1
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.1 Final
>         Environment: Operating System: other
> Platform: Other
>            Reporter: Ralf Hauser
>         Assigned To: Struts Developers
>            Priority: Minor
>
> It appears to be good practice to execute a maxlength validation for all form
> fields, especially the ones eventually ending up in a database.
> To save the programmer all the configuration writing chores, I suggest to
> automate this in the following way:
> Assume there is a registration form with the field "private String loginName;" -
> if there is also
> a) int loginName_maxLength = 60; //adapt value to permitted field length in DB
> b) the below global "automateMaxLength" is set to "true"
> then
> i) always execute the "maxlength" validation rule (no need to list that in
> validation.xml)
> ii) always amend the '<html:text property="loginName"' in jsps using the
> registration form with 'maxlength="60"' as per
> http://jakarta.apache.org/struts/userGuide/struts-html.html#text
> and
> iii) if the below "autoOnChangeJS" is "true", amend the same '<html:text
> property="loginName"' with an
> 'onchange="MODAL_MAX_LENGHT_AUTOGENERATED_JAVA_SCRIPT"' for those who expect
> their visitors to have JavaScript enabled.
> The configuration block in the struts-config.xml thus should be enhanced with
> two properties:
> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
>   ...
>   <set-property property="automateMaxLength" value="true"/>
>   <set-property property="autoOnChangeJS" value="true"/>
>   ...
> </plug-in>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message