*.do in struts 1.2
I think I know Struts 1.2 very well, but still I am confused about t开发者_开发百科he *.do
pattern.
Can you please explain the simple meaning of the pattern *.do
? And why it is only *.do
?
Thanks in advance!
This is just a URL mapping of the struts action Servlet as shown below (copied from struts doc). It can be anything you want. *.do is the default mapping I believe.
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>
/WEB-INF/struts-config.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
*.do
is mentioned in the Struts documentation and has become the defacto standard. But you can choose anything you like. Another common pattern is /do/*
.
精彩评论