Seems to me that traverseResourceLoaders() in wicket.Localizer has a bug:

prefix = Strings.beforeLast(prefix, '.');

... should be:

prefix = Strings.afterFirst(prefix, '.');

The iteration goes from the page down to the component so that component-path 
prefix should be shortened from the head instead of the tail:

a.b.c.d.foo.RequiredValidator
b.c.d.foo.RequiredValidator
c.d.foo.RequiredValidator
d.foo.RequiredValidator
foo.RequiredValidator

There was some huge refactoring done on revision 1.21, this functionality was 
previously located in ComponentStringResourceLoader.java (with the correct 
method call afterFirst()).

Sven

>Thanks for the answer, but I had already looked at that page. The
>problem is that the page shows a sample that is not like my case. Let
>me explain:
>
>In the page you sent you have the following component hierarchy:
>APage
>->BForm id="b"
>   -->XPanel id="x"
>        ---->RequiredTextField id="foo"
>   -->YPanel id="y"
>        ---->RequiredTextField id="foo"
>
>In this case make sense to have a XPanel.properties without a
>reference to the form, like:
>   foo.RequiredValidator = Foo is required.
>
>But in my case, the form is inside the panel, as I would like to use
>the full form as a reusable component:
>APage
>->APanel id="ap"
>   -->AForm id="af"
>       ---->RequiredTextField id="foo"
>
>I would expect in this case that the APanel.properties would include
>also the form id:
>   af.foo.RequiredValidator = Foo is required.
>
>The problem of using only foo.RequiredValidator in this case will
>appear when trying to add two forms in the same Panel:
>
>APage
>->APanel id="ap"
>   -->AForm id="af"
>       ---->RequiredTextField id="foo"
>   -->BForm id="bf"
>       ---->RequiredTextField id="foo"
>
>If I use the form id in the APanel.properties, I will have no problem:
>
>   af.foo.RequiredValidator = Foo is required.
>   bf.foo.RequiredValidator = Foo is extremely required.
>
>but if I don't use the form id, how I can differentiate them in the panel?
>
>Thank you very much.
>
>___
>André Matheus
>
>
>On 2/22/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
>> Please see http://www.wicket-wiki.org.uk/wiki/index.php/Validation_Messages
>>
>> Juergen
>>
>> On 2/22/06, Andre Matheus <[EMAIL PROTECTED]> wrote:
>> > Hi all,
>> >
>> > I am using the wicket-1.2-20060216.jar
>> >
>> > I have a panel called PersonFormPanel where I add a form with 
>id=personForm
>> > In this form I add an RequiredTextField with id=name
>> >
>> > I created a properties file in the same folder with an entry like this:
>> > personForm.name.RequiredValidator=Name is a Mandatory field
>> >
>> > The problem is that when I try to submit the form without the name
>> > value, I am getting this error:
>> > Unexpected RuntimeException
>> > Root cause:
>> > java.util.MissingResourceException: Unable to find resource: 
>RequiredValidator
>> >
>> > If i change the properties file to use:
>> > name.RequiredValidator=Name is a Mandatory field
>> > It works fine, but it ignores the form Id.
>> >
>> > Is this the expected behaviour?
>> >
>> > The problem I see with this is that I can not have two different forms
>> > in my panel with elements with equivalent ids and different messages.
>> >
>> > Best regards,
>> >
>> > --
>> > __
>> > André Matheus
>> >
>> >
>> > -------------------------------------------------------
>> > This SF.net email is sponsored by: Splunk Inc. Do you grep through log 
>files
>> > for problems?  Stop!  Download the new AJAX search engine that makes
>> > searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
>> > http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642
>> > _______________________________________________
>> > Wicket-user mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >
>>
>>
>> -------------------------------------------------------
>> This SF.net email is sponsored by: Splunk Inc. Do you grep through log 
>files
>> for problems?  Stop!  Download the new AJAX search engine that makes
>> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
>> http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642
>> _______________________________________________
>> Wicket-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>
>
>--
>__
>André Matheus
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
>for problems?  Stop!  Download the new AJAX search engine that makes
>searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
>_______________________________________________
>Wicket-user mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to