Get HttpServletRequest via Maven repository
Problem
Using Maven build tool, which jar should include to use HttpServletRequest
or HttpServletResponse
?
Solution
To use HttpServletRequest
or HttpServletResponse
in a development environment, include servlet-api. jar
in your Maven pom.xml
file.
pom.xml
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
Put scope as provided
, because most j2ee containers have this jar. You need this for complication only, not deployment.
Add this to POM.XML
javax
javaee-api
6.0
They changed the artifact id…
javax.servlet
javax.servlet-api
3.1.0
provided
The idea provided here was very helpful.
It is still using the servlet from jdk. This is causing problem for me.
Thanks A LOT!
I fogot the scope provided.
A hug.
Doug
javax
javaee-api
6.0
Hi,
Whenever we use the Maven install command, will get the .war file without having the lib folder.
I’ve some doubts to deploy the WAR file into some other Development, Test or Production server where ill get those supported files and run my application.
could you please kindly give me some details.