I am new Java Struts 1 framework. But I want to ask a question.
In struts-config.xml
path
value ends with .do
like this "/AddReq.do"
, or path
value is only action name like this "AddReq"
?
What is difference between "/AddReq.do"
and "AddReq"
?
For example:
<action path="/AddReqPage"
type="...actions.AddReqPageAction">
<forward name="success" path="AddReq" />
<forward name="failure" path="/bos.jsp" />
</action>
<action path="/AddReq"
type="...actions.AddReqAction"
name="AddReqForm" validate="true"
scope="request">
<forward name="success" path="/AddReqDetail.do" />
<forward name="hata" path="AddReq" />
<forward name="failure" path="/bos.jsp" />
</action>
Not much difference. Both should work - provided you map to Struts ActionServlet
correctly in your web.xml
.
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
Conventionally, Struts uses *.do
pattern to distingush its servlet from other servlets and JSPs.