Working with Wicket I was sadly surprised by the behaviour of StringValue class. I needed to get optional parameters from URL, such as page number or document id. This parameters may have values, but can be omited and should be replaced by default value.
So I used this code to get page number, default page is 1.
PageParameters parameters = ...
int currentPage = parameters.get("page").toInt(1); // default value is 1
Unfortunatelly, toInt(1) throwed StringValueConversionException instead of returning 1.
So I used this code to get page number, default page is 1.
PageParameters parameters = ...
int currentPage = parameters.get("page").toInt(1); // default value is 1
Unfortunatelly, toInt(1) throwed StringValueConversionException instead of returning 1.