ha yes just checked out the source ,thanks :) On Wed, Nov 23, 2011 at 5:46 PM, Matthias Keller <matthias.kel...@ergon.ch> wrote: > Hi > > And you can even leave away the > > if(params.getNamedKeys().contains("parameter_name")) > > and just do: > > StringValue param = params.get("param"); // or use an index if you wish > if (!param.isEmpty()) { > ... param.toString() ... > } > > Matt > > On 2011-11-23 12:17, vineet semwal wrote: >> >> 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<ianmarshall...@gmail.com> >> 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()) >>> ... > > >
-- thank you, regards, Vineet Semwal --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org