AlexTM wrote:
> 
> add(new Label("country", new PropertyModel(this,
> "ipLocationInfo.country")));
> 
> The country information is sometimes null and then i would like to display
> "unknown" instead. 
> 

One way of doing this would be to create your own model.

add(new Label("country", new AbstractReadOnlyModel() {
    public Object getObject() {
        String country = getIpLocationInfo().getCountry();
        if (country != null)
            return country;
        else
            return "Unknown";
    }
}));

-- 
View this message in context: 
http://www.nabble.com/Display-a-String-when-null-tp17062912p17063240.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]

Reply via email to