form表单的action属性设置相对路径

代码如下,当form表单中的action值为savebyform.do时,该表单提交的路径会是什么呢?
<form name="form1" action="savebyform.do" method="post">
      <input name="code" id="code" type="text" value="${code}"/><br>
      <input type="submit"  name ="savebyform" value="save(form)"/> 
</form>  

测试1:当页面的访问路径为:http://localhost:9080/rmlogic/index.jsp时

则提交的路径为:

测试2:当页面的访问路径为:http://localhost:9080/rmlogic/test/index.jsp时

则提交的路径为:

总结:

也就是说,action值的相对路径是指相对当前页面所在的路径或者跳转到当前页面的请求路径。
 

猜你喜欢

转载自blog.csdn.net/weixin_42321329/article/details/105777085
今日推荐