I have a controller class in Spring MVC project. My code is like below:
@Controller
public class MainController {
@RequestMapping(value = "/doLogin")
public String login(@RequestParam("email") String email, @RequestParam("pwd") String password, Model model){
//some code
}
}
I want to pass HttpSession as method parameter but I'm not able to access HttpSession. I've attached a screenshot:
This is because you don't have servlet api dependency in your classpath.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
You need to have java servlet
in your project. Add this to your pom.xml
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
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