request.getParameter in JSP

I haven't got too much experience with JSP but I thought that String action = request.getParameter("action"); was a fairly standard way of getting information.
If that is right, then why does IDEA hightlight getParameter in red and say cannot resolve method?

2 comments

Your code is correct, and would work as expected.
Do you have the servlet API configured as a library?

For example, if you're using maven, you'd need a dependency like:
-----------------------------
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>
-----------------------------


Hope that helps,
-tt
0

You can try like this.

<%!String action="";%>

<%action=(String)request.getParameter("action");%>

0

Please sign in to leave a comment.