I'm not sure what's wrong, but why not use the i18n feature? Create a .properties file with name of the page that your label is located, put it in the same folder of the page (like were you put the html). The label should be something like this:
add( new Label( "page.label", new ResourceModel( "page.label" ) ); check: http://cwiki.apache.org/WICKET/general-i18n-in-wicket.html Hope that was helpful. Eyal On Mon, Jun 2, 2008 at 12:34 PM, wenm <[EMAIL PROTECTED]> wrote: > > I want to read a properties file test.properties, and show the value which > is > defined in properties file in a lable. But I can't read the properties file > > I have tried > property.load(ClassLoader.getSystemResourceAsStream("test.properties")); > > property.load(this.getClass().getClassLoader().getResourceAsStream("test.properties")); > property.load(PackageResource.get(test.class, > "test.properties").getResourceStream().getInputStream()); > property.load(((WebApplication) > > Application.get()).getServletContext().getResourceAsStream("test.properties")); > > But it always generate null point error > java.lang.NullPointerException > at java.util.Properties$LineReader.readLine(Properties.java:365) > at java.util.Properties.load(Properties.java:293) > > Then I tried to test reading in main method, and it works fine there. > public static void main(String[] args){ > Properties property = new Properties(); > try { > > property.load(ClassLoader.getSystemResourceAsStream("test.properties")); > } catch (IOException e) { > e.printStackTrace(); } > System.out.println(property.getProperty("a key")); > } > > Really can't understand why. Did I do something in wrong way? Thanks for > any > help or sugestion. > > -- > View this message in context: > http://www.nabble.com/problem-when-reading-properties-file-tp17597421p17597421.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74
