|Summary:||[Enh] add option to always use default selection in input:select|
|Product:||Taglibs||Reporter:||Rhett Sutphin <rhett>|
|Component:||Input Taglib||Assignee:||Tomcat Developers Mailing List <dev>|
|Attachments:||Implement ignoreRequest for input:select|
Description Rhett Sutphin 2004-06-17 21:26:30 UTC
Somtimes it is useful to set the selected values for a SELECT tag from values other than the request parameters. Such a selection can be generated and passed to the input:select tag through the default attribute, but can be trumped if the wrong combo of request parameters are present. The following patch adds a boolean ignoreRequest attribute to input:select to force it to use the default value(s).
Comment 1 Rhett Sutphin 2004-06-17 21:28:13 UTC
Created attachment 11876 [details] Implement ignoreRequest for input:select
Comment 2 Karl von Randow 2004-06-20 22:29:55 UTC
This is something that could be useful for all of the tags in the input library probably. Is ignoreRequest the best way to achieve it or could we have something like a "value" attribute which behaves like default but cancels the behaviour of looking in a request and in the bean (if provided). What are your thoughts?
Comment 3 Rhett Sutphin 2004-06-25 18:44:34 UTC
I think it could be useful for any tag that provides behavior besides the automatic fill-in of the value from the request. Otherwise, you could just use the HTML. For example: the reason why I use input:select it that it lets me specify the options as a Map and specify which one of them is selected. input:text, on the other hand, doesn't seem to have anything going for it over pure HTML, except for the fact that it will take a value out of the request and use it as its value. If you added an ignoreRequest attribute, you might as well have just done <input type="text" ... />. Also: It seems to me that if you don't want to use the bean attribute, you could just omit it. However, I haven't used the input taglib that much so I could be missing something.
Comment 4 Karl von Randow 2004-07-04 00:45:32 UTC
It is a useful feature. The text box is still useful even if you don't use the request as it will perform all of the necessary character escaping etc for your values. Now all I'm considering is whether to call the attribute ignoreRequest or useRequest - with a default of true. I'm going to have a look at other taglibs to see if there's a defacto standard
Comment 5 Karl von Randow 2007-04-22 01:01:23 UTC
I have just committed a solution to this. I have added value/selectedValue(s)/checkedValue(s) to all of the input tags. This can be used instead of default(s) to specify an actual value to use rather than a default that can be overridden. I chose "value" rather than "ignoreRequest" as it is closer to the actual "value" attribute in the HTML input tag.