Spring Sitemesh3 POST失败
转载 HTMLSpring Sitemesh3 POST失败,spring,sitemesh,Spring,Sitemesh,转载 HTML <form action="testPost" method="post"> <input type="submit" value="Submit" /> </form> 在添加sitemesh3筛选器之前,“post”方法完美执行的提交操作 但一旦添加sitemesh3筛选器,如果更改了HTML和操作以获取,仍然可以完美地工作,但是如果更改为POST,则会调用该操作,但返回“405-请求方法”POST“不受支持” 所以我认为sit
<form action="testPost" method="post">
<input type="submit" value="Submit" />
</form>
在添加sitemesh3筛选器之前,“post”方法完美执行的提交操作
但一旦添加sitemesh3筛选器,如果更改了HTML和操作以获取,仍然可以完美地工作,但是如果更改为POST,则会调用该操作,但返回“405-请求方法”POST“不受支持”
所以我认为sitemesh3在对客户端的操作响应时改变了一些东西。我查看了sitemesh3的源代码,但没有发现任何有价值的东西
有人能帮忙吗?提前感谢。我不确定这是否与您的设置有关,但我有相同的错误(405帖子不受支持) 起初我认为这与sitemesh有关。然而,在我的例子中,当我进一步研究它时,这是因为我使用
来提供到装饰器的静态映射
由于sitemesh试图使用post请求访问装饰器文件,因此不接受该文件的post请求的是
我更改了装饰器文件的映射,以确保它是静态的,并响应POST和GET请求。这里有更多细节
我使用的代码是
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="urlMap">
<map>
<entry key="/DecTest/**" value="myResourceHandler" />
</map>
</property>
<property name="order" value="100000" />
</bean>
<bean id="myResourceHandler" name="myResourceHandler"
class="org.springframework.web.servlet.resource.ResourceHttpRequestHandler">
<property name="locations" value="/DecTest/" />
<property name="supportedMethods">
<list>
<value>GET</value>
<value>HEAD</value>
<value>POST</value>
</list>
</property>
<!-- cacheSeconds: maybe you should set it to zero because of the posts-->
</bean>
得到
头
邮递
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="urlMap">
<map>
<entry key="/DecTest/**" value="myResourceHandler" />
</map>
</property>
<property name="order" value="100000" />
</bean>
<bean id="myResourceHandler" name="myResourceHandler"
class="org.springframework.web.servlet.resource.ResourceHttpRequestHandler">
<property name="locations" value="/DecTest/" />
<property name="supportedMethods">
<list>
<value>GET</value>
<value>HEAD</value>
<value>POST</value>
</list>
</property>
<!-- cacheSeconds: maybe you should set it to zero because of the posts-->
</bean>