I want to return ArrayList<HashMap<String,String>> in EL function with three String argument. How to do that?
I want to return ArrayList<HashMap<String,String>> in EL function with three String argument. How to
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Actually I think it’s perfectly reasonable to have an EL function return some complex object. Of course, there are issues of “architectural style” that might dictate what would and would not be appropriate situations for such a thing, but I’d say that a good example would be some facility for returning some kinds of configuration information that is not specific to any particular action, not really of interest to back-end business logic, and likely to be of use for presentation purposes on many pages.
To do that, what you want is an EL function that returns “Object”, or perhaps “Object[]”. You can’t use the Java generics stuff in your EL declarations (in your .tld file, that is), but that doesn’t really matter because the EL environment does type sniffing anyway. What you’d do is declare a public static function in a class somewhere:
In your .tld file, you’ll have something like this:
In your JSP, you’d access the function like this: