now how do I go about setting a default resource bundle?
Jason Carreira wrote:
The visitor validator will look for the key in your Template class's resource bundle property files, not the property files of your Action class. You can add a default resource bundle if you want to have global messages.
-----Original Message-----
From: Francisco Hernandez [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2003 7:24 PM
To: [EMAIL PROTECTED]
Subject: Re: [OS-webwork] Re: use getText to resolve errors in controlheader.vm
excellent thanks, but theres one more issue now using key worked when not using a visitor, using a visitor it fails to resolve the key, my config below:
my ActionClass-validation.xml:
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.dtd">
<validators>
<!-- THIS ONE DOES NOT WORK -->
<field name="template">
<field-validator type="visitor">
<message></message>
</field-validator>
</field>
<!-- THIS WORKS FINE --> <field name="template.name"> <field-validator type="requiredstring"> <message key="template.name.errors.required"/> </field-validator> </field> </validators>
Template-validation.xml in same package as the Template class:
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.dtd">
<validators>
<field name="name">
<field-validator type="requiredstring">
<message key="template.name.errors.required">No Key Found!</message>
</field-validator>
</field>
</validators>
Chris Chen wrote:
What you should be doing is the following:
<message key="template.name.errors.required">A default
message in case
the key is not found</message>
Thanks, Chris
----- Original Message ----- From: "Francisco Hernandez" <[EMAIL PROTECTED]> Newsgroups: gmane.comp.java.open-symphony.webwork Sent: Monday, November 17, 2003 3:39 PM Subject: Re: use getText to resolve errors in controlheader.vm
ok I've so then maybe theres a problem with the validator
or somewhere
else, my validator is running correctly and adds template.name.errors.required to the fieldError but its not
resolving
the text, I tried using:
<message>text('template.name.errors.required')</message>
<message>getText('template.name.errors.required')</message>
also but that didnt work.
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.dtd">
<validators> <field name="name"> <field-validator type="requiredstring"> <message>template.name.errors.required</message> </field-validator> </field> </validators>
Jason Carreira wrote:
Messages should be evaluated / localized before they are
added to the
message maps. The validation framework does this already.
-----Original Message-----
From: Francisco Hernandez [mailto:[EMAIL PROTECTED]
Sent: Monday, November 17, 2003 11:08 AM
To: [EMAIL PROTECTED]
Subject: [OS-webwork] use getText to resolve errors in controlheader.vm
controlheader.vm currently doesnt resolve errors using getText, below is the modified vm
(PS: Jira is down so I couldnt post bug..)
controlheader.vm
## Only show message if errors are available. ## This will be done if ActionFormSupport is used.
#if( $fieldErrors.get($parameters.name) ) #set ($errors = $fieldErrors.get($parameters.name)) #foreach ($error in $fieldErrors.get($parameters.name)) <tr> #if ($parameters.labelposition == 'top') <td align="left" valign="top" colspan="2"> #else <td align="center" valign="top" colspan="2"> #end <span class="errorMessage"> #set( $message = $stack.findValue("getText('${error}')") ) #if( $message && $message != "" ) $message<br> #else $!error<br> #end </span> </td> </tr> #end #end
## if the label position is top, ## then give the label it's own row in the table
<tr> #if ($parameters.labelposition == 'top') <td align="left" valign="top" colspan="2"> #else <td align="right" valign="top"> #end
#if ($errors) <span class="errorLabel"> #else <span class="label"> #end
#if ($parameters.label) $parameters.label: #end </span> </td>
## add the extra row #if ($parameters.labelposition == 'top') </tr> <tr> #end <td>
-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer
from any Web browser or wireless device. Click here to
Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/
g22lp.tmpl
_______________________________________________
Opensymphony-webwork mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer
from any Web browser or wireless device. Click here to Try
it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=
/g22lp.tmp
l _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your
computer from
any Web browser or wireless device. Click here to Try it Free! https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=m
m/g22lp.tm
pl
------------------------------------------------------- This SF. Net email is sponsored by: GoToMyPC GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free! https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tm
pl
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
------------------------------------------------------- This SF. Net email is sponsored by: GoToMyPC GoToMyPC is the fast, easy and secure way to access your computer from any Web browser or wireless device. Click here to Try it Free! https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
------------------------------------------------------- This SF. Net email is sponsored by: GoToMyPC GoToMyPC is the fast, easy and secure way to access your computer from any Web browser or wireless device. Click here to Try it Free! https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=/g22lp.tmpl _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
------------------------------------------------------- This SF. Net email is sponsored by: GoToMyPC GoToMyPC is the fast, easy and secure way to access your computer from any Web browser or wireless device. Click here to Try it Free! https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork