SpringMVC里form表单提交到action指定路径404
如图提交表单之后,出现404页面。
错误原因
tomcat配置的路径中在端口号之后还有路径:
如http://localhost:8080/ssmTest_war_exploded
而action=“/form”中跳转时,
路径为http://localhost:8080/form,正确路径应为http://localhost:8080/ssmTest_war_exploded/form
解决方法
一、填充路径
把
<form action="/logon">
改为
<form action="${pageContext.request.contextPath}/logon">
二、修改tomcat路径
2.修改tomcat配置 url 路径为http://localhost:8080