You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Christopher Schultz (JIRA)" <ve...@apache.org> on 2006/04/15 16:43:01 UTC

[jira] Created: (VELTOOLS-58) ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.

ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.
------------------------------------------------------------------------------------------------------------------

         Key: VELTOOLS-58
         URL: http://issues.apache.org/jira/browse/VELTOOLS-58
     Project: VelocityTools
        Type: Bug

  Components: VelocityStruts  
    Versions: 1.2, 1.3    
 Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / Commons-Validator 1.1.4
    Reporter: Christopher Schultz


I recently decided to split my application properties files into multiple bundles instead of one huge bundle in an effort to maintain some order. This required me to change my validation configuration to include the "bundle" property on my message elements:

      <field property="questionTypeId"
            depends="required,integer">
        <arg position="0" bundle="Clinician" key="prompt.responseOption.questionTypeId"/>
      </field>

The ValidatorTool.getDynamicJavascript does not respect this setting and so I get messages like "The field ???en_US.responseOption.questionTypeId??? is required.".

ValidatorTool.getDynamicJavascript first gets the global message bundle and re-uses it for all of the error messages emitted by the javascript generator:

		String message = Resources.getMessage(messages, locale, va, field);

In order to respect the <msg>'s bundle, the code should instead be this:

		String message = Resources.getMessage(app,
						      request,
						      messages,
						      locale,
						      va,
						      field);

It turns out that this doesn't fix the problem, although I'm sure that this change should be made. Perhaps someone with a better understanding of Struts/Validator/VelocityTools could shed some light on this situation.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (VELTOOLS-58) ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.

Posted by "Christopher Schultz (JIRA)" <ve...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELTOOLS-58?page=all ]

Christopher Schultz updated VELTOOLS-58:
----------------------------------------

    Attachment: VELTOOLS-58.patch

Patch to fix this issue.


> ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-58
>                 URL: http://issues.apache.org/jira/browse/VELTOOLS-58
>             Project: VelocityTools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.2, 1.3
>         Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / Commons-Validator 1.1.4
>            Reporter: Christopher Schultz
>         Attachments: VELTOOLS-58.patch
>
>
> I recently decided to split my application properties files into multiple bundles instead of one huge bundle in an effort to maintain some order. This required me to change my validation configuration to include the "bundle" property on my message elements:
>       <field property="questionTypeId"
>             depends="required,integer">
>         <arg position="0" bundle="Clinician" key="prompt.responseOption.questionTypeId"/>
>       </field>
> The ValidatorTool.getDynamicJavascript does not respect this setting and so I get messages like "The field ???en_US.responseOption.questionTypeId??? is required.".
> ValidatorTool.getDynamicJavascript first gets the global message bundle and re-uses it for all of the error messages emitted by the javascript generator:
> 		String message = Resources.getMessage(messages, locale, va, field);
> In order to respect the <msg>'s bundle, the code should instead be this:
> 		String message = Resources.getMessage(app,
> 						      request,
> 						      messages,
> 						      locale,
> 						      va,
> 						      field);
> It turns out that this doesn't fix the problem, although I'm sure that this change should be made. Perhaps someone with a better understanding of Struts/Validator/VelocityTools could shed some light on this situation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (VELTOOLS-58) ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.

Posted by "Niall Pemberton (JIRA)" <ve...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELTOOLS-58?page=comments#action_12435000 ] 
            
Niall Pemberton commented on VELTOOLS-58:
-----------------------------------------

I don't use velocity, but the way it works in the equivalent Struts <html:javascript> tag (and the <html:errors/> and <html:messages> tags) is that the bundle attribute on these tags sets the bundle for all the messages UNLESS they have been overriden by settings in the validation config.

Also, as a "heads up" - Struts 1.3.5 which looks like its going to be voted GA has added resource support for validator variables - see the section "1.2 Variables in Resource Bundles" on the following page:
   http://wiki.apache.org/jakarta-commons/ValidatorVersion120

Related Struts changes:
   http://svn.apache.org/viewvc?view=rev&revision=289694




> ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-58
>                 URL: http://issues.apache.org/jira/browse/VELTOOLS-58
>             Project: VelocityTools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.2, 1.3
>         Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / Commons-Validator 1.1.4
>            Reporter: Christopher Schultz
>         Attachments: ValidatorTool.java, VELTOOLS-58.patch
>
>
> I recently decided to split my application properties files into multiple bundles instead of one huge bundle in an effort to maintain some order. This required me to change my validation configuration to include the "bundle" property on my message elements:
>       <field property="questionTypeId"
>             depends="required,integer">
>         <arg position="0" bundle="Clinician" key="prompt.responseOption.questionTypeId"/>
>       </field>
> The ValidatorTool.getDynamicJavascript does not respect this setting and so I get messages like "The field ???en_US.responseOption.questionTypeId??? is required.".
> ValidatorTool.getDynamicJavascript first gets the global message bundle and re-uses it for all of the error messages emitted by the javascript generator:
> 		String message = Resources.getMessage(messages, locale, va, field);
> In order to respect the <msg>'s bundle, the code should instead be this:
> 		String message = Resources.getMessage(app,
> 						      request,
> 						      messages,
> 						      locale,
> 						      va,
> 						      field);
> It turns out that this doesn't fix the problem, although I'm sure that this change should be made. Perhaps someone with a better understanding of Struts/Validator/VelocityTools could shed some light on this situation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (VELTOOLS-58) ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.

Posted by "Nathan Bubna (JIRA)" <ve...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELTOOLS-58?page=comments#action_12434054 ] 
            
Nathan Bubna commented on VELTOOLS-58:
--------------------------------------

With that comment, i attached an updated version of ValidatorTool.java with the methods that take a bundle param.

> ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-58
>                 URL: http://issues.apache.org/jira/browse/VELTOOLS-58
>             Project: VelocityTools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.2, 1.3
>         Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / Commons-Validator 1.1.4
>            Reporter: Christopher Schultz
>         Attachments: ValidatorTool.java, VELTOOLS-58.patch
>
>
> I recently decided to split my application properties files into multiple bundles instead of one huge bundle in an effort to maintain some order. This required me to change my validation configuration to include the "bundle" property on my message elements:
>       <field property="questionTypeId"
>             depends="required,integer">
>         <arg position="0" bundle="Clinician" key="prompt.responseOption.questionTypeId"/>
>       </field>
> The ValidatorTool.getDynamicJavascript does not respect this setting and so I get messages like "The field ???en_US.responseOption.questionTypeId??? is required.".
> ValidatorTool.getDynamicJavascript first gets the global message bundle and re-uses it for all of the error messages emitted by the javascript generator:
> 		String message = Resources.getMessage(messages, locale, va, field);
> In order to respect the <msg>'s bundle, the code should instead be this:
> 		String message = Resources.getMessage(app,
> 						      request,
> 						      messages,
> 						      locale,
> 						      va,
> 						      field);
> It turns out that this doesn't fix the problem, although I'm sure that this change should be made. Perhaps someone with a better understanding of Struts/Validator/VelocityTools could shed some light on this situation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (VELTOOLS-58) ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.

Posted by "Nathan Bubna (JIRA)" <ve...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELTOOLS-58?page=all ]

Nathan Bubna updated VELTOOLS-58:
---------------------------------

    Fix Version/s: 1.3

I want to make sure this is in line with the Struts tags before we release 1.3.

> ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-58
>                 URL: http://issues.apache.org/jira/browse/VELTOOLS-58
>             Project: VelocityTools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.2, 1.3
>         Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / Commons-Validator 1.1.4
>            Reporter: Christopher Schultz
>             Fix For: 1.3
>
>         Attachments: ValidatorTool.java, VELTOOLS-58.patch
>
>
> I recently decided to split my application properties files into multiple bundles instead of one huge bundle in an effort to maintain some order. This required me to change my validation configuration to include the "bundle" property on my message elements:
>       <field property="questionTypeId"
>             depends="required,integer">
>         <arg position="0" bundle="Clinician" key="prompt.responseOption.questionTypeId"/>
>       </field>
> The ValidatorTool.getDynamicJavascript does not respect this setting and so I get messages like "The field ???en_US.responseOption.questionTypeId??? is required.".
> ValidatorTool.getDynamicJavascript first gets the global message bundle and re-uses it for all of the error messages emitted by the javascript generator:
> 		String message = Resources.getMessage(messages, locale, va, field);
> In order to respect the <msg>'s bundle, the code should instead be this:
> 		String message = Resources.getMessage(app,
> 						      request,
> 						      messages,
> 						      locale,
> 						      va,
> 						      field);
> It turns out that this doesn't fix the problem, although I'm sure that this change should be made. Perhaps someone with a better understanding of Struts/Validator/VelocityTools could shed some light on this situation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Resolved: (VELTOOLS-58) ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELTOOLS-58?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Bubna resolved VELTOOLS-58.
----------------------------------

    Resolution: Fixed

> ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-58
>                 URL: https://issues.apache.org/jira/browse/VELTOOLS-58
>             Project: Velocity Tools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.2, 1.3
>         Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / Commons-Validator 1.1.4
>            Reporter: Christopher Schultz
>             Fix For: 1.3
>
>         Attachments: ValidatorTool.java, VELTOOLS-58.patch
>
>
> I recently decided to split my application properties files into multiple bundles instead of one huge bundle in an effort to maintain some order. This required me to change my validation configuration to include the "bundle" property on my message elements:
>       <field property="questionTypeId"
>             depends="required,integer">
>         <arg position="0" bundle="Clinician" key="prompt.responseOption.questionTypeId"/>
>       </field>
> The ValidatorTool.getDynamicJavascript does not respect this setting and so I get messages like "The field ???en_US.responseOption.questionTypeId??? is required.".
> ValidatorTool.getDynamicJavascript first gets the global message bundle and re-uses it for all of the error messages emitted by the javascript generator:
> 		String message = Resources.getMessage(messages, locale, va, field);
> In order to respect the <msg>'s bundle, the code should instead be this:
> 		String message = Resources.getMessage(app,
> 						      request,
> 						      messages,
> 						      locale,
> 						      va,
> 						      field);
> It turns out that this doesn't fix the problem, although I'm sure that this change should be made. Perhaps someone with a better understanding of Struts/Validator/VelocityTools could shed some light on this situation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (VELTOOLS-58) ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.

Posted by "Christopher Schultz (JIRA)" <ve...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELTOOLS-58?page=comments#action_12434003 ] 
            
Christopher Schultz commented on VELTOOLS-58:
---------------------------------------------

It turns out that I was wrong... my propsed fix /does/ work: I just needed to have all my settings right.

This method in ValidatorTool:

    protected String getDynamicJavascript(ValidatorResources resources,
                                          Locale locale,
                                          Form form)

Has the following code in it:

 		String message =
 		    Resources.getMessage(messages, locale, va, field);

This should be changed to:

		String message =
		    Resources.getMessage(app, request,
					 messages, locale, va, field);

...and then the "bundle" attribute for argument elements in the validator config files will be respected.


> ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-58
>                 URL: http://issues.apache.org/jira/browse/VELTOOLS-58
>             Project: VelocityTools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.2, 1.3
>         Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / Commons-Validator 1.1.4
>            Reporter: Christopher Schultz
>
> I recently decided to split my application properties files into multiple bundles instead of one huge bundle in an effort to maintain some order. This required me to change my validation configuration to include the "bundle" property on my message elements:
>       <field property="questionTypeId"
>             depends="required,integer">
>         <arg position="0" bundle="Clinician" key="prompt.responseOption.questionTypeId"/>
>       </field>
> The ValidatorTool.getDynamicJavascript does not respect this setting and so I get messages like "The field ???en_US.responseOption.questionTypeId??? is required.".
> ValidatorTool.getDynamicJavascript first gets the global message bundle and re-uses it for all of the error messages emitted by the javascript generator:
> 		String message = Resources.getMessage(messages, locale, va, field);
> In order to respect the <msg>'s bundle, the code should instead be this:
> 		String message = Resources.getMessage(app,
> 						      request,
> 						      messages,
> 						      locale,
> 						      va,
> 						      field);
> It turns out that this doesn't fix the problem, although I'm sure that this change should be made. Perhaps someone with a better understanding of Struts/Validator/VelocityTools could shed some light on this situation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (VELTOOLS-58) ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.

Posted by "Christopher Schultz (JIRA)" <ve...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELTOOLS-58?page=comments#action_12434145 ] 
            
Christopher Schultz commented on VELTOOLS-58:
---------------------------------------------

Nathan,

Sorry, I'm not used to using JIRA, and I didn't notice the attachment.

I'm not sure that your extensive changes are entirely necessary, since the desired bundle is read out of the validator configuration, and doesn't need to be passed-in to these javascript generating methods.

The 'messages' passed into the Resources.getMessage method is just the "default", and that method will use the bundle declared in the validator config to choose the appropriate bundle. I think we just needed to be calling the appropriate method.

I'm happy to test your fix, but I don't think it really adds anything to my 4-line patch.

-chris


> ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-58
>                 URL: http://issues.apache.org/jira/browse/VELTOOLS-58
>             Project: VelocityTools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.2, 1.3
>         Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / Commons-Validator 1.1.4
>            Reporter: Christopher Schultz
>         Attachments: ValidatorTool.java, VELTOOLS-58.patch
>
>
> I recently decided to split my application properties files into multiple bundles instead of one huge bundle in an effort to maintain some order. This required me to change my validation configuration to include the "bundle" property on my message elements:
>       <field property="questionTypeId"
>             depends="required,integer">
>         <arg position="0" bundle="Clinician" key="prompt.responseOption.questionTypeId"/>
>       </field>
> The ValidatorTool.getDynamicJavascript does not respect this setting and so I get messages like "The field ???en_US.responseOption.questionTypeId??? is required.".
> ValidatorTool.getDynamicJavascript first gets the global message bundle and re-uses it for all of the error messages emitted by the javascript generator:
> 		String message = Resources.getMessage(messages, locale, va, field);
> In order to respect the <msg>'s bundle, the code should instead be this:
> 		String message = Resources.getMessage(app,
> 						      request,
> 						      messages,
> 						      locale,
> 						      va,
> 						      field);
> It turns out that this doesn't fix the problem, although I'm sure that this change should be made. Perhaps someone with a better understanding of Struts/Validator/VelocityTools could shed some light on this situation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (VELTOOLS-58) ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELTOOLS-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12465918 ] 

Nathan Bubna commented on VELTOOLS-58:
--------------------------------------

Ok.  At this point, i don't see much value in overloading most of the methods to take a bundle name as a parameter (as i did in the ValidatorTool.java i attached).

So, i've committed Christopher's patch (not sure why i hadn't already done that), and i also made another change to support the new feature Niall pointed out.  It basically mirrors what was done to the JavascriptValidatorTag in Struts revision 289694.

If anyone really wants the functions to have an optional bundle param, let me know.  Then i'll check it in, and you can test it for me. :)   If this happens after 1.3 is out the door, we can just do a 1.3.1 release.

This is the path of least resistance for me.  Speak now or forever... speak later. ;-)

> ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-58
>                 URL: https://issues.apache.org/jira/browse/VELTOOLS-58
>             Project: Velocity Tools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.2, 1.3
>         Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / Commons-Validator 1.1.4
>            Reporter: Christopher Schultz
>             Fix For: 1.3
>
>         Attachments: ValidatorTool.java, VELTOOLS-58.patch
>
>
> I recently decided to split my application properties files into multiple bundles instead of one huge bundle in an effort to maintain some order. This required me to change my validation configuration to include the "bundle" property on my message elements:
>       <field property="questionTypeId"
>             depends="required,integer">
>         <arg position="0" bundle="Clinician" key="prompt.responseOption.questionTypeId"/>
>       </field>
> The ValidatorTool.getDynamicJavascript does not respect this setting and so I get messages like "The field ???en_US.responseOption.questionTypeId??? is required.".
> ValidatorTool.getDynamicJavascript first gets the global message bundle and re-uses it for all of the error messages emitted by the javascript generator:
> 		String message = Resources.getMessage(messages, locale, va, field);
> In order to respect the <msg>'s bundle, the code should instead be this:
> 		String message = Resources.getMessage(app,
> 						      request,
> 						      messages,
> 						      locale,
> 						      va,
> 						      field);
> It turns out that this doesn't fix the problem, although I'm sure that this change should be made. Perhaps someone with a better understanding of Struts/Validator/VelocityTools could shed some light on this situation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (VELTOOLS-58) ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.

Posted by "Nathan Bubna (JIRA)" <ve...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELTOOLS-58?page=comments#action_12434172 ] 
            
Nathan Bubna commented on VELTOOLS-58:
--------------------------------------

I added the bundle support both because you originally thought your fix did not work, and because JavascriptValidatorTag has functionality equivalent to it via a bundle attribute.

Now, i'm curious why they have that...  perhaps to override the bundle configured in your validator config??

Anyway, i'd rather not add something i only half-understand, so i'll probably just commit your patch unless you or someone can vouch for the purpose of the rest.

> ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-58
>                 URL: http://issues.apache.org/jira/browse/VELTOOLS-58
>             Project: VelocityTools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.2, 1.3
>         Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / Commons-Validator 1.1.4
>            Reporter: Christopher Schultz
>         Attachments: ValidatorTool.java, VELTOOLS-58.patch
>
>
> I recently decided to split my application properties files into multiple bundles instead of one huge bundle in an effort to maintain some order. This required me to change my validation configuration to include the "bundle" property on my message elements:
>       <field property="questionTypeId"
>             depends="required,integer">
>         <arg position="0" bundle="Clinician" key="prompt.responseOption.questionTypeId"/>
>       </field>
> The ValidatorTool.getDynamicJavascript does not respect this setting and so I get messages like "The field ???en_US.responseOption.questionTypeId??? is required.".
> ValidatorTool.getDynamicJavascript first gets the global message bundle and re-uses it for all of the error messages emitted by the javascript generator:
> 		String message = Resources.getMessage(messages, locale, va, field);
> In order to respect the <msg>'s bundle, the code should instead be this:
> 		String message = Resources.getMessage(app,
> 						      request,
> 						      messages,
> 						      locale,
> 						      va,
> 						      field);
> It turns out that this doesn't fix the problem, although I'm sure that this change should be made. Perhaps someone with a better understanding of Struts/Validator/VelocityTools could shed some light on this situation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (VELTOOLS-58) ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.

Posted by "Nathan Bubna (JIRA)" <ve...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELTOOLS-58?page=comments#action_12433999 ] 
            
Nathan Bubna commented on VELTOOLS-58:
--------------------------------------

Hmm.  Here's the latest JavascriptValidatorTag.java source as a reference:

http://svn.apache.org/viewvc/struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/html/JavascriptValidatorTag.java?view=markup
and the javadoc for the Resources class
http://struts.apache.org/1.x/struts-core/apidocs/org/apache/struts/validator/Resources.html

i can't see the difference in Resources docs, nor did it make a difference for you, but since JavascriptValidatorTag makes the change you suggest, we probably should too.

in general though, it looks like we need a way for you to request a specific bundle to be used at the start of the getDynamicJavascript(...) method where the MessageResources are obtained.  This probably means matching versions of all the public methods but with the addition of a bundle parameter.

> ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-58
>                 URL: http://issues.apache.org/jira/browse/VELTOOLS-58
>             Project: VelocityTools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.2, 1.3
>         Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / Commons-Validator 1.1.4
>            Reporter: Christopher Schultz
>
> I recently decided to split my application properties files into multiple bundles instead of one huge bundle in an effort to maintain some order. This required me to change my validation configuration to include the "bundle" property on my message elements:
>       <field property="questionTypeId"
>             depends="required,integer">
>         <arg position="0" bundle="Clinician" key="prompt.responseOption.questionTypeId"/>
>       </field>
> The ValidatorTool.getDynamicJavascript does not respect this setting and so I get messages like "The field ???en_US.responseOption.questionTypeId??? is required.".
> ValidatorTool.getDynamicJavascript first gets the global message bundle and re-uses it for all of the error messages emitted by the javascript generator:
> 		String message = Resources.getMessage(messages, locale, va, field);
> In order to respect the <msg>'s bundle, the code should instead be this:
> 		String message = Resources.getMessage(app,
> 						      request,
> 						      messages,
> 						      locale,
> 						      va,
> 						      field);
> It turns out that this doesn't fix the problem, although I'm sure that this change should be made. Perhaps someone with a better understanding of Struts/Validator/VelocityTools could shed some light on this situation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (VELTOOLS-58) ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.

Posted by "Christopher Schultz (JIRA)" <ve...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELTOOLS-58?page=comments#action_12433989 ] 
            
Christopher Schultz commented on VELTOOLS-58:
---------------------------------------------

Can anyone comment on this bug?


> ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-58
>                 URL: http://issues.apache.org/jira/browse/VELTOOLS-58
>             Project: VelocityTools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.2, 1.3
>         Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / Commons-Validator 1.1.4
>            Reporter: Christopher Schultz
>
> I recently decided to split my application properties files into multiple bundles instead of one huge bundle in an effort to maintain some order. This required me to change my validation configuration to include the "bundle" property on my message elements:
>       <field property="questionTypeId"
>             depends="required,integer">
>         <arg position="0" bundle="Clinician" key="prompt.responseOption.questionTypeId"/>
>       </field>
> The ValidatorTool.getDynamicJavascript does not respect this setting and so I get messages like "The field ???en_US.responseOption.questionTypeId??? is required.".
> ValidatorTool.getDynamicJavascript first gets the global message bundle and re-uses it for all of the error messages emitted by the javascript generator:
> 		String message = Resources.getMessage(messages, locale, va, field);
> In order to respect the <msg>'s bundle, the code should instead be this:
> 		String message = Resources.getMessage(app,
> 						      request,
> 						      messages,
> 						      locale,
> 						      va,
> 						      field);
> It turns out that this doesn't fix the problem, although I'm sure that this change should be made. Perhaps someone with a better understanding of Struts/Validator/VelocityTools could shed some light on this situation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (VELTOOLS-58) ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.

Posted by "Nathan Bubna (JIRA)" <ve...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELTOOLS-58?page=all ]

Nathan Bubna updated VELTOOLS-58:
---------------------------------

    Attachment: ValidatorTool.java

Here, try this out.  I haven't tested it, but it compiles.  I think it should be able to do what you want.  If it works, let me know, and i'll commit it.

> ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-58
>                 URL: http://issues.apache.org/jira/browse/VELTOOLS-58
>             Project: VelocityTools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.2, 1.3
>         Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / Commons-Validator 1.1.4
>            Reporter: Christopher Schultz
>         Attachments: ValidatorTool.java, VELTOOLS-58.patch
>
>
> I recently decided to split my application properties files into multiple bundles instead of one huge bundle in an effort to maintain some order. This required me to change my validation configuration to include the "bundle" property on my message elements:
>       <field property="questionTypeId"
>             depends="required,integer">
>         <arg position="0" bundle="Clinician" key="prompt.responseOption.questionTypeId"/>
>       </field>
> The ValidatorTool.getDynamicJavascript does not respect this setting and so I get messages like "The field ???en_US.responseOption.questionTypeId??? is required.".
> ValidatorTool.getDynamicJavascript first gets the global message bundle and re-uses it for all of the error messages emitted by the javascript generator:
> 		String message = Resources.getMessage(messages, locale, va, field);
> In order to respect the <msg>'s bundle, the code should instead be this:
> 		String message = Resources.getMessage(app,
> 						      request,
> 						      messages,
> 						      locale,
> 						      va,
> 						      field);
> It turns out that this doesn't fix the problem, although I'm sure that this change should be made. Perhaps someone with a better understanding of Struts/Validator/VelocityTools could shed some light on this situation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (VELTOOLS-58) ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.

Posted by "Christopher Schultz (JIRA)" <ve...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELTOOLS-58?page=comments#action_12434009 ] 
            
Christopher Schultz commented on VELTOOLS-58:
---------------------------------------------

Nathan,

I didn't see anything to try out, but my patch works; all of the messages that I have properly configured are now working.

-chris


> ValidatorTool does not respect 'bundle' property for message elements when generating client-side validation code.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-58
>                 URL: http://issues.apache.org/jira/browse/VELTOOLS-58
>             Project: VelocityTools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.2, 1.3
>         Environment: JDK 1.4.2_09 / Tomcat 4.1.31 / Struts 1.2.7 / Commons-Validator 1.1.4
>            Reporter: Christopher Schultz
>         Attachments: ValidatorTool.java, VELTOOLS-58.patch
>
>
> I recently decided to split my application properties files into multiple bundles instead of one huge bundle in an effort to maintain some order. This required me to change my validation configuration to include the "bundle" property on my message elements:
>       <field property="questionTypeId"
>             depends="required,integer">
>         <arg position="0" bundle="Clinician" key="prompt.responseOption.questionTypeId"/>
>       </field>
> The ValidatorTool.getDynamicJavascript does not respect this setting and so I get messages like "The field ???en_US.responseOption.questionTypeId??? is required.".
> ValidatorTool.getDynamicJavascript first gets the global message bundle and re-uses it for all of the error messages emitted by the javascript generator:
> 		String message = Resources.getMessage(messages, locale, va, field);
> In order to respect the <msg>'s bundle, the code should instead be this:
> 		String message = Resources.getMessage(app,
> 						      request,
> 						      messages,
> 						      locale,
> 						      va,
> 						      field);
> It turns out that this doesn't fix the problem, although I'm sure that this change should be made. Perhaps someone with a better understanding of Struts/Validator/VelocityTools could shed some light on this situation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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