It seems the default attribute type for Tag Handler class is always "String". What if I need to pass a user-defined data type or just an arraylist ? For example, I want to do ---
************ In other words, "param1" and "param2" are not String type. Is that OK ? From what I have tested it doesn't work at all. It seems it requires the type to be "String". That's not good. We often need to pass complicated things to a JSP. If a Tag Handler class only accepts String, can can I handle the situation that I need Arraylist or other user-defined data structure ?
What is the value of param1? The string arraylist_1.
But that's not waht you want. You want the value of the scripting variable arraylist_1 to be passed.
So how would you differentiate the two?
Hint:
Let's say that you wanted to emit the value of arraylist_1 in a paragraph. Would you write is as:
?
No. How would you write it?
If I am not mistakening you want Frank to "loop" through the ArrayList to retrieve the String values (correct me if I get you wrong). It sounds like it works, but I don't think it is a general way to do what he wants. What if the data type he wants to pass is more complex than an Array that you can loop through ?
I think the "general" way is to let the action class use "request.setAttribute" to pass that specific data type instance. And in the Tag Handler class it can use .getRequest to retrieve that instance.