Thank you for giving such an explicit answer, Steve. The thing is, I do that all the time, and this is the answer for when you have an associated component. I am looking for how to do it with strings shared throughout the WebApplication; i.e., there is no component and the string is in the application's xml file. I've looked all over Wicket in Action and perhaps it's in there, but I just can't find it. That's why I'm posting.
So I have the string I need in my app.xml. Within a panel on one of the pages, I instantiate a StringResourceModel with a string ID from the app.xml file like so: class MyPanel extends Panel { ... add( new Label( strLabelId, new StringResourceModel( strRescId, null ) ) ); ... } I'm guessing I need to use the StringResourceModel(String resourceKey, IModel<?> model) ctor because the string is not associated with a component, and I'm setting the model to null because ultimately I'd be getting the value from a bean if I did and the bean can't return the string for the same reason I'm having troubles, namely that it's not a component so it can't have a properties file associated with it. I get a runtime exception that it can't find that string for my component, which makes perfect sense. I understand why it fails. I can kludge a workaround. I don't want to; I know you have the capability to create a shared string table and I want to do it right. So what am I doing wrong? Steve Swinsburg-2 wrote: > > You can also just use ResourceModel("some.string.property") if you > don't have any thing that needs to be substituted into the strings > when they are rendered. > ie > some.string.property=this is some text > > or StringResourceModel( various constructors ) if you need some > dynamic value in there: > ie > some.string.property=This is a {0} string > > This will work from the same YourApplicationName.properties file. > > > cheers, > Steve > > > > On 11/03/2009, at 7:24 PM, Jeremy Thomerson wrote: > >> Put them in YourApplicationName.properties and use >> StringResourceModel. See >> internationalization help in Wicket in Action. >> >> -- >> Jeremy Thomerson >> http://www.wickettraining.com >> >> >> >> On Wed, Mar 11, 2009 at 2:20 PM, Seven Corners >> <shel...@blackwave.tv> wrote: >> >>> >>> I have some strings that I'd like to access from a common string >>> table that >>> is not tied to any particular component. How can I do this? >>> -- >>> View this message in context: >>> http://www.nabble.com/Shared-string-resources- >>> tp22462537p22462537.html >>> Sent from the Wicket - User mailing list archive at Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>> For additional commands, e-mail: users-h...@wicket.apache.org >>> >>> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > > -- View this message in context: http://www.nabble.com/Shared-string-resources-tp22462537p22481472.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org