David - thanks for adding your thoughts to the issue. Now some more of my thoughts to Jonathan's message...

On Wednesday, June 25, 2003, at 12:36 AM, DeRose Jonathan wrote:
1) Putting an '*' into a label for required fields assumes people want an
'*', maybe they want a '(R)' or maybe they want something else entirely
(perhaps an image...).

Certainly a valid enhancement. Perhaps something with MessageFormat would do the trick here, allowing the field value to be plugged into another resource string ("{0}*:" or "{0} (R)").


I'm not really going to be on board with all the generalizations being made discussed here though. By generalizing it as much as David has suggested, along with ideas being discussed here it would require more than just this in our JSP's:

<custom:label key="FormName.fieldName"/>

If the generalizations make more required in my JSP's then I'll stick with my custom tag. In fact, even the form name is not needed, as I discussed previously, in the key.

My tag also has another interesting feature. We store our message resources in the database. When the user is logged in with a special role ("dev" in our case) then the label tag outputs they key names rather than their value (making it instantly apparent which text is hard-coded into the JSP and which is put into the resources). That key is also a hyperlink to a pop-up form allowing the user to enter a new value for that resource key.

Another feature of my tag is that if the value of a key ends with '?' then the colon is omitted. The label values do not contain colons, it is automatically appended to all labels except questions, where a colon separator looks a bit ugly.

2) Putting an '*' after a label for required fields assumes people want an
'*' after the label. Perhaps they want the '*' before the label or after
the actual input field. Consider the label 'Name:' with three text boxes
for first, last, and middle. First and last might be required but middle is
not. There is no clear way to mark first and last but not middle with this
enhancement.

Yet another reason I'll stick with my custom version :)) You guys come up with far too complex scenarios and its easier to just deal with this our own way. If a built-in tag requires more work for JSP developers, then no thanks - it'd be overkill for our purposes.


3) Forcing people to use the ResourceBundle to display labels requires a lot
more effort for applications that have no internationalization requirements.
For many web applications, html text is enough and does not require a heavy
resource bundle to maintain or keep in memory.

No one would be forcing anyone to use such a tag. So I don't quite understand your issue here. Simply hard-code the labels in the JSP's if you like, which is what most folks, or use <bean:message>.


But we have applications that require user customization, and by providing a means for them to edit the resources (again, they reside in a database table) it takes us developers out of the loop and they can edit them basically in-place on the screen using our "dev" role feature.

If there is a strong desire for an asterisk tag, why not just have a tag
that takes a property and prints out an asterisk if it is required?

Certainly a simple tag that just does that would be useful for some folks, sure. For us, its nice to roll the error checking, required check, "?"/":" handling, and more all into a single tag.


Or even better, set up whatever symbol you want to show for required fields
in the resource bundle, and then use that. <html:required
property='form.element' />


EX: ApplicationResources.properties
html.required=*
-or-
html.required=(R)
-or-
html.required=<IMG SRC="./required.gif">

*ugh* - HTML in the properties file is something I'm definitely against.


I have proposed an enhancement that I think offers more flexibility from the
error handling perspective:
* It allows for error styles, error classes, and error ids for labels AND
for all of the input elements. (You could make the label 'Name:' red and
bold, or you could make the name text box highlighted in red, or both) It
allows developers to set up these styles once in the ResourceBundle and be
used over the entire application
html.text.styleClass=text_input
html.text.errorStyleClass=red_text_input
* It allows you to group errors (a single error for 'SSN' can make the
'SSN:' label bold and highlight all three text inputs).
* The label tag wraps whatever specific label you want to use, whether it is
a message from the ResourceBundle or just plain HTML.

It sounds like you've done a great job writing tag(s) for your particular uses. I think, ultimately, we'll find that a generalized tag will be fine for some folks, but just not enough for many of us. Given what our tag does, I don't think we'd consider using a lesser-featured built-in one (except maybe to subclass it if you guys build it nicely enough! :).


I feel this offers the kind of flexibility and extensibilty that I think
Struts needs.
Please check out this enhancement at
http://issues.apache.org/bugzilla/show_bug.cgi?id=20784

I'll definitely keep my eye on the development of this. I agree that something along these lines is what folks need to build webapps with Struts. Whether a generalized solution exists still remains to be seen. Simple tags to display labels and do what David suggests in his comments to the Bugzilla issue, and perhaps a really simple one to just show an asterisk (or some custom text) if a field is required would be good to have as well.


Erik


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to