我对struts的认识:struts is a framework.它的特点是可重用,整合多项技术于其中。
struts是基于当前的一些相关标准的开发技术(servlet,xml…)基础之上,提供了一个开发框架的开放源码项目
对struts 的认识要从两个关键文件开始:web.xml and struts-config.xml。他们是整个struts' brigde。
struts' controller is web.xml。系统指令(jsp页面触发后)在web.xml中找到ActionServlet类。并从struts-config.xml读取配置信息。
一、WEB.XML的解读
<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>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!--以下的servlet可以映射成do为后缀的文件-->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!--以下为系统的默认首页 -->
……………………

二、STRUTS-CONFIG.XML
<struts-config>
<!--FormBean是struts中的概念,本质是JavaBean用来自动存储页面表单中各个域的值,并在适当的时候回填表单域。常被action-mapping中的action使用 -->
<form-beans>
<global-fowards>
……………………全局转向中转地址
<global-fowards>
<!-- web.xml中后缀为do的请求在此处理-->
<action-mapping>
<action path type name scope input forward……………………/>
</action-mapping>
</struts-config>
3211

被折叠的 条评论
为什么被折叠?



