spring - The type javax.servlet.http.HttpServletResponse cannot be resolved. It is indirectly referenced from required .class files -


i new spring try create application can learn how work. when wrote code eclipse ide gives

the type javax.servlet.http.httpservletresponse cannot resolved.it indirectly referenced required .class files

here class

package testpackage;   import org.springframework.web.servlet.modelandview; import org.springframework.web.servlet.mvc.simpleformcontroller; import domain.servicelayer.userservice; import domain.userdetails.user;  @suppresswarnings("deprecation") public class userloginformcontroller extends simpleformcontroller  {     private userservice userservice;      public userloginformcontroller() {         setcommandclass(user.class);         setcommandname("user");     }     public void setuserservice(userservice userservice) {         this.userservice = userservice;     }      @override     public modelandview onsubmit(object command) throws exception {         // todo auto-generated method stub          user user = (user) command;         userservice.add(user);         modelandview modelandview = new modelandview("success", "user", user);         return modelandview;     }  } 

and pom.xml

<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://maven.apache.org/pom/4.0.0                       http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelversion>4.0.0</modelversion>     <groupid>learnsimpleformcontroller</groupid>     <artifactid>learnsimpleformcontroller</artifactid>     <version>1.0</version>     <packaging>war</packaging>       <properties>         <spring.version>3.2.3.release</spring.version>     </properties>     <dependencies>         <!-- spring 3 dependencies -->         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-core</artifactid>             <version>${spring.version}</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-web</artifactid>             <version>${spring.version}</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-webmvc</artifactid>             <version>${spring.version}</version>         </dependency>        <!-- servlet -->         <dependency>             <groupid>javax.servlet</groupid>             <artifactid>servlet-api</artifactid>             <version>2.5</version>             <scope>provided</scope>         </dependency>         <dependency>             <groupid>javax.servlet.jsp</groupid>             <artifactid>jsp-api</artifactid>             <version>2.1</version>             <scope>provided</scope>         </dependency>         <dependency>             <groupid>javax.servlet</groupid>             <artifactid>jstl</artifactid>             <version>1.2</version>         </dependency>         </dependencies>     <build>         <finalname>learnsimpleformcontroller</finalname>     </build> </project> 

please problem , how remove error

your project not referencing servlet.jar add dependency in pom

<dependency>     <groupid>org.apache.geronimo.specs</groupid>     <artifactid>geronimo-servlet_2.5_spec</artifactid>     <version>1.2</version> </dependency> 

Comments