HttpServletRequest request;
Enumeration params = request.getParameterNames();
How should I declare the return type for the above method?
This method was parameterized since Servlet API 3.0 (Java EE 6). In older versions like Servlet API 2.5 (Java EE 5) and before this method (and many others) is not parameterized. You're apparently running a Servlet 2.5 container or older. You have basically 2 options:
Upgrade to a Servlet 3.0 container (Tomcat 7, Glassfish 3, JBoss AS 6, etc) so that you can do
Enumeration<String> params = request.getParameterNames();
Make an unchecked cast.
@SuppressWarnings("unchecked")
Enumeration<String> params = (Enumeration<String>) request.getParameterNames();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With