在Spring MVC中使用哪个版本的servlet api?

时间:2015-04-11 09:09:38

标签: java spring spring-mvc servlets

每个Spring MVC版本使用哪个版本的servlet api,哪里可以找到这样的信息?我在文档中找不到它们。

3 个答案:

答案 0 :(得分:1)

还有另一种了解依赖项的方法:

如果可以通过mvnrepository找到某些内容(例如Spring WebMVC),则可以在其中查找依赖项。

例如:

org.springframework » spring-webmvc

在以下位置:提供的依赖项

--------------------------------------------------------------
|WebMVC     |Dependency                       |Min-Max version
--------------------------------------------------------------
|5.1.9      |javax.servlet » javax.servlet-api|4.0.1
--------------------------------------------------------------
|5.0.15     |javax.servlet » javax.servlet-api|4.0.1
--------------------------------------------------------------
|4.3.25     |javax.servlet » javax.servlet-api|3.0.1 - 4.0.1
--------------------------------------------------------------
|4.2.9      |javax.servlet » javax.servlet-api|3.0.1 - 4.0.1
--------------------------------------------------------------
|4.1.9      |javax.servlet » javax.servlet-api|3.0.1 - 4.0.1
--------------------------------------------------------------
|4.0.9      |javax.servlet » javax.servlet-api|3.0.1 - 4.0.1
--------------------------------------------------------------
|3.2.18     |javax.servlet » javax.servlet-api|3.0.1 - 4.0.1
--------------------------------------------------------------
|3.1.4      |javax.servlet » javax.servlet-api|2.1 - 2.3.3
--------------------------------------------------------------
|3.0.7      |javax.servlet » javax.servlet-api|2.1 - 2.3.3
--------------------------------------------------------------
|2.5.6.SEC03|javax.servlet » javax.servlet-api|2.4 - 4.0.1
--------------------------------------------------------------
|2.0.8      |javax.servlet » javax.servlet-api|2.4 - 4.0.1
--------------------------------------------------------------

答案 1 :(得分:0)

Spring MVC 4主要关注Servlet 3.0+环境。 该信息在spring框架参考手册中给出。

答案 2 :(得分:0)

其依赖范围:“提供” @PowerStat,不应视为完全依赖。

https://mvnrepository.com/artifact/org.springframework/spring-webmvc/5.0.0.RELEASE

def create(response):
        if response.method == "POST":
                form = CreateNewTrade(response.POST)

                # Because form.is_valid() failed, t will be undefined
                if form.is_valid():
                        n = form.cleaned_data["name"]

                        # Here only, you have assigned value of t
                        t = AssetList(name=n)
                        t.save()
                        response.user.assetlist.add(t)

                        return HttpResponseRedirect("/userdash/%i" %t.id)

        # When if statements doesnot apply, always come to this line unless it goes inside form.is_valid()
        return HttpResponseRedirect("/userdash/")   # redirect to the page whose arguments doesnot depend upon the form subbmission

摘自官方文件 https://github.com/spring-projects/spring-framework/wiki/What%27s-New-in-Spring-Framework-5.x#whats-new-in-version-50