You need to make sure that that you provide a Template.properties resource bundle file that contains the key "template.name.errors.required".
When using the visitor validator, the <message> contains the message to prepend to every validation error message that you specify in the Template-validation.xml file. If you leave it blank, then no string will get prepended to your Template validation error messages. Now, you just need to create a new resource bundle file for your Template if you haven't already done so. One thing that I think is a little annoying is the way that the errors messages are composed for the visitor validator. The error messages contain brackets around the error message. Ie. instead of simply just * here is an error message It will output the error message like this * [ here is an error message ] Why add those brackets to the error message? It sorta screws up the display of error messages from the action error messages. Can we possibly remove them? Thanks, Chris ----- Original Message ----- From: "Francisco Hernandez" <[EMAIL PROTECTED]> Newsgroups: gmane.comp.java.open-symphony.webwork Sent: Monday, November 17, 2003 4:24 PM Subject: Re: 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.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 > > > > > > > > > > ------------------------------------------------------- > > 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=mm/g22lp.tmpl ------------------------------------------------------- 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