Forms and the list of values
So, with the recent change of Form being a ParameterList the methods getFirstValue() and getValues() were created. Unfortunately, getValues() only returns the list of a parameters values as a comma-separated String. I.e., there's no way to get a List of the values for the parameter. As it stands now, I have to either limit my code to using only the first value specified or I have to actually parse the string returned by getValues(). Is there a reason this limitation was added? Wouldn't it be better to change getValues() to e.g., getValuesString() and add a ParameterList getValues (name) method? Also, fyi, the documentation for: public Parameter getFirst(String name) gives the wrong description: Returns the value of the first parameter found with the given name. Thanks, John
RE: Forms and the list of values
Hi John, > Is there a reason this limitation was added? Wouldn't it be better to > change getValues() to e.g., getValuesString() and add a ParameterList > getValues (name) method? The method was renamed to "subList(String name)", following the List API code style. If you just really need a list of strings, then we need to add another method indeed. Let me know. > Also, fyi, the documentation for: public Parameter getFirst(String > name) gives the wrong description: Returns the value of the first > parameter found with the given name. Fixed! Thanks, Jerome
Re: Forms and the list of values
On 6/8/06, Jerome Louvel <[EMAIL PROTECTED]> wrote: [...] > Is there a reason this limitation was added? Wouldn't it be better to > change getValues() to e.g., getValuesString() and add a ParameterList > getValues (name) method? The method was renamed to "subList(String name)", following the List API code style. If you just really need a list of strings, then we need to add another method indeed. Let me know. Doh! I missed that completey. Sorry for the confusion. Returning the ParameterList is just fine by me. Thanks, John
Re: Forms and the list of values
Hi John, [...] > Is there a reason this limitation was added? Wouldn't it be better to > change getValues() to e.g., getValuesString() and add a ParameterList > getValues (name) method? If you only need read-only access to the provided parameters I can offer an alternative that also capable to read parameters from GET and POST/PUT the same time (if I remember right, this was also a requirement you have). If you want I can send you the code. It uses String[] arrays and offers less functionality than the Form/ParameterList classes but for my purposes it just fits. :) Best regards, Lars -- http://www.semagia.com
Re: Forms and the list of values
That would be great. I'd love to try it out. Thanks, John On 6/8/06, Lars Heuer <[EMAIL PROTECTED]> wrote: Hi John, [...] > Is there a reason this limitation was added? Wouldn't it be better to > change getValues() to e.g., getValuesString() and add a ParameterList > getValues (name) method? If you only need read-only access to the provided parameters I can offer an alternative that also capable to read parameters from GET and POST/PUT the same time (if I remember right, this was also a requirement you have). If you want I can send you the code. It uses String[] arrays and offers less functionality than the Form/ParameterList classes but for my purposes it just fits. :) Best regards, Lars -- http://www.semagia.com