首页 > struts的url加action和不加action为什么访问不一样?

struts的url加action和不加action为什么访问不一样?

http://localhost:8080/HelloWorldStruts/name.action

<form id="HelloWorld" name="HelloWorld" onsubmit="return true;" action="/HelloWorldStruts/HelloWorld.action" method="post"></form>

http://localhost:8080/HelloWorldStruts/index.jsp

<form id="HelloWorld" onsubmit="return true;" action="HelloWorld" method="post"></form>

这两个是同一个网页, 第一个是在struts.xml中的action中配置的, 第二个是在web.xml中的welcome-file-list中配置的,但是加了action的网页可以继续成功提交请求,而以jsp结尾的则是报错404,无法找到/HelloWorldStruts/HelloWorld

这是这个网页的内容

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Name Collector</title>
</head>
<body>
    <s:form action="HelloWorld">
    </s:form>
    <hr>    
</body>
</html>

为什么会有这么大不同呢?

【热门文章】
【热门文章】