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?

0

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
2
Avatar
Permanently deleted user

You can try like this.

<%!String action="";%>

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

0

请先登录再写评论。