could anyone please clarify the meaning of line generalizes the tag object’s storage of attributes in the following line of Head First Servlets & JSP (page no. 555):
One solution would be to put all of the attributes into a hashtable. This
generalizes the tag object’s storage
of attributes, but what about all
these setter methods? We can’t get rid
of them unless there’s a way to tell
the JSP engine to set the tag
attributes using a generic
interface.
Thanks in advance.
“Generalizes” in this context means that you can write one function or one small piece of code that implements all of your cases rather than writing each case separately. I don’t have that book, but it looks like it replaces something like:
with
That’s generalizing the storage — the code is meant to show a generic hashtable that maps strings to strings — you would use something like this
The other code would be used something like this: