PageParameters in 1.5: a sanity check request
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 ListStringValue 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 ListStringValue 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: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: PageParameters in 1.5: a sanity check request
ListStringValue 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 ListStringValue 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 ListStringValue 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: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- thank you, regards, Vineet Semwal - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: PageParameters in 1.5: a sanity check request
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: ListStringValue 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 Marshallianmarshall...@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 ListStringValue 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 ListStringValue liSVs = params.getValues([Param name]); if ((liSVs != null) !liSVs.isEmpty()) ... smime.p7s Description: S/MIME Cryptographic Signature
Re: PageParameters in 1.5: a sanity check request
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: ListStringValue 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 Marshallianmarshall...@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 ListStringValue 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 ListStringValue 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
Re: PageParameters in 1.5: a sanity check request
Thanks for your comments, Guys. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageParameters-in-1-5-a-sanity-check-request-tp4099136p4099956.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org