Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在Spring Security中使用CSRF登录后,如何通过POST提交从以前的URL获取表单数据?_Java_Spring_Jsp_Spring Mvc_Spring Security - Fatal编程技术网

Java 在Spring Security中使用CSRF登录后,如何通过POST提交从以前的URL获取表单数据?

Java 在Spring Security中使用CSRF登录后,如何通过POST提交从以前的URL获取表单数据?,java,spring,jsp,spring-mvc,spring-security,Java,Spring,Jsp,Spring Mvc,Spring Security,在成功登录后,我尝试通过POST表单提交重定向到上一个URL,因为我在下面配置了bean。我可以通过POST提交重定向,但在这里,我尝试上载文件,但在登录后无法获取多部分对象,即。,我得到的文件对象为空。请帮助我实现这一点,谢谢提前。这是我的bean和XML配置。 spring security.xml <http> <csrf /> <request-cache ref="requestCache" /> </http> <beans:b

在成功登录后,我尝试通过POST表单提交重定向到上一个URL,因为我在下面配置了bean。我可以通过POST提交重定向,但在这里,我尝试上载文件,但在登录后无法获取多部分对象,即。,我得到的文件对象为空。请帮助我实现这一点,谢谢提前。这是我的bean和XML配置。
spring security.xml

<http>
<csrf />
<request-cache ref="requestCache"  />
</http>
<beans:bean id="requestCache" class="com.web.listeners.Test" />
test.jsp

<c:url value="/file/uploadFile?${_csrf.parameterName}=${_csrf.token}" var="uploadFileURL"/>
                    <form:form action="${uploadFileURL}" method="post" enctype="multipart/form-data" modelAttribute="multiPartVo">
                    <input id="file" name="file" type="file" />
                    <button type="submit" value="SAVE" ></button>
                    </form:form>


不知道这是否有帮助:@KarlNicholas感谢您的建议,但他们编写的相同代码无法解决我的问题。在这里,我可以在登录后重定向到登录前的url,但我无法获取表单数据,即。,多部分文件数据的null值确实出现。@KarlNicholas这里它重定向到上一个URL,但多部分文件数据的null值确实出现。
<c:url value="/file/uploadFile?${_csrf.parameterName}=${_csrf.token}" var="uploadFileURL"/>
                    <form:form action="${uploadFileURL}" method="post" enctype="multipart/form-data" modelAttribute="multiPartVo">
                    <input id="file" name="file" type="file" />
                    <button type="submit" value="SAVE" ></button>
                    </form:form>