I am new Java Struts framework. But I want to ask a question.
In struts-config.xml
path is .do
like "/AddReq.do"
OR path is only name like "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