Re: [Wicket-user] Easier way to force resourceKey for a Validator error message
I was earlier returning a "***" kind of String when the Spring MessageSource failed to resolve the key (so that missing error messages would be obvious). Obviously that was the wrong thing to do. The trick is to return null so that Wicket continue trying to resolve the message in the sequence you described. Thanks Igor for the tip - things work as they should now : ) On 2/3/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote: i believe the search order is to first try the id.key and then to try key, so your messages should still resolve properly. can you break in localizer and see what its doing? -igor On 2/3/07, Peter Thomas <[EMAIL PROTECTED]> wrote: > Hi, > > I'm migrating an existing (Spring MVC) JSP application to Wicket and > this application already has i18n with just one largish properties file, > named as per Spring tradition "messages.properties". > > I'm using Wicket 1.2.4. I was able to easily delegate looking up of > messages to Spring's "MessageSource" by doing > getResourceSettings().addStringResourceLoader(new IStringResourceLoader() in > the Application class. This is working fine. > > My problem is when I have a custom Validator attached to a form > component. In the Validator, I am trying to force the resourceKey that will > be used to resolve the error message by overriding "protected String > resourceKey(FormComponent)". > > The problem is the Component id is always being prefixed to whatever I > try to set the resourceKey to. All I want to do is to tell wicket to use a > specific key as-is for a validation error and not prefix anything to it. > > I guess that if I were using the Wicket default StringResourceLoader, I > could have used an ApplicationName.properties to "generalize" messages. > But you see my problem, this is a migration and I would really like to use > my existing resource bundles as is and I am tied to the Spring message > source for now. > > Any way around this? > > Thanks, > > Peter. > > > - > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your job > easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Easier way to force resourceKey for a Validator error message
i believe the search order is to first try the id.key and then to try key, so your messages should still resolve properly. can you break in localizer and see what its doing? -igor On 2/3/07, Peter Thomas <[EMAIL PROTECTED]> wrote: Hi, I'm migrating an existing (Spring MVC) JSP application to Wicket and this application already has i18n with just one largish properties file, named as per Spring tradition "messages.properties". I'm using Wicket 1.2.4. I was able to easily delegate looking up of messages to Spring's "MessageSource" by doing getResourceSettings().addStringResourceLoader(new IStringResourceLoader() in the Application class. This is working fine. My problem is when I have a custom Validator attached to a form component. In the Validator, I am trying to force the resourceKey that will be used to resolve the error message by overriding "protected String resourceKey(FormComponent)". The problem is the Component id is always being prefixed to whatever I try to set the resourceKey to. All I want to do is to tell wicket to use a specific key as-is for a validation error and not prefix anything to it. I guess that if I were using the Wicket default StringResourceLoader, I could have used an ApplicationName.properties to "generalize" messages. But you see my problem, this is a migration and I would really like to use my existing resource bundles as is and I am tied to the Spring message source for now. Any way around this? Thanks, Peter. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Easier way to force resourceKey for a Validator error message
Hi, I'm migrating an existing (Spring MVC) JSP application to Wicket and this application already has i18n with just one largish properties file, named as per Spring tradition "messages.properties". I'm using Wicket 1.2.4. I was able to easily delegate looking up of messages to Spring's "MessageSource" by doing getResourceSettings().addStringResourceLoader(new IStringResourceLoader() in the Application class. This is working fine. My problem is when I have a custom Validator attached to a form component. In the Validator, I am trying to force the resourceKey that will be used to resolve the error message by overriding "protected String resourceKey(FormComponent)". The problem is the Component id is always being prefixed to whatever I try to set the resourceKey to. All I want to do is to tell wicket to use a specific key as-is for a validation error and not prefix anything to it. I guess that if I were using the Wicket default StringResourceLoader, I could have used an ApplicationName.properties to "generalize" messages. But you see my problem, this is a migration and I would really like to use my existing resource bundles as is and I am tied to the Spring message source for now. Any way around this? Thanks, Peter. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user