List<StringValue> liSVs = params.getValues([Param name]);
if ((liSVs != null) && !liSVs.isEmpty())
{
StringValue svValue = liSVs.get(0);
String sValue = svValue.toOptionalString();
...
}
you can just do
if(params.getNamedKeys().contains("parameter_name"))
{
String svValue = params.get(parameter_name)
String sValue = svValue.toOptionalString();
if(!Strings.isEmpty(sValue)){
--your code--
}
}
On Wed, Nov 23, 2011 at 4:06 PM, Ian Marshall <[email protected]> wrote:
> I have ported my app from 1.4.18 to 1.5.1 (I haven't used 1.5.3 yet).
>
> As part of my porting, I had to adjust the use of page parameters. I would
> like to mention my changes for parameter extraction and existence
> determination below, in case someone can mention a cleaner way to do these
> things...
>
> import org.apache.wicket.util.string.StringValue;
>
> Replace
>
> if (params.containsKey([Param name]))
> {
> String sValue = params.getString([Param name]);
> ...
> }
>
> with
>
> List<StringValue> liSVs = params.getValues([Param name]);
> if ((liSVs != null) && !liSVs.isEmpty())
> {
> StringValue svValue = liSVs.get(0);
> String sValue = svValue.toOptionalString();
> ...
> }
>
> and replace
>
> String sUserName = params.getString([Key name], [Empty default string]);
> if (!sUserName.isEmpty())
> ...
>
> with
>
> List<StringValue> liSVs = params.getValues([Param name]);
> if ((liSVs != null) && !liSVs.isEmpty())
> ...
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/PageParameters-in-1-5-a-sanity-check-request-tp4099136p4099136.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
thank you,
regards,
Vineet Semwal
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]