配置Struts

 

配置Struts

web.xml

Struts程序的ActionServlet是整个程序的控制中心,且可以被继承,当Struts程序启动的时候,需要在web.xml中找到它并启动,然后让它自己工作。所以要配置该servlet,即<servlet></servlet>,<servlet-mapping></servlet-mapping>

可能需要在<servlet></servlet>内配置四个初始化变量:application,config,debug,detail

另一个需要配置在web.xml中的组件是标记库(可选):

      <taglib>

            <taglib-uri></taglib-uri>

            <taglib-locatiion></taglib-locatiion>

      </taglib>

<taglib-uri>给出程序中使用的标记库的名称,<taglib-location>标记库存放的位置

struts-config.xml

tomcat运行的时候,会加载工程的web.xml文件,此加载过程中初始化struts-config.xml文件。struts-config.xml文件告诉程序要加载Struts组件的时候,在哪个位置寻找。

根元素< struts-config>有8个子元素:data-sources, form-beans, global-exceptions, global-forwards, action-mappings, controller, message-resources, plug-in

<struts-config>

      <data-sources></data-sources>

      <form-beans>

            <form-bean name="" type="">

                  <form-peroperty name="" type=""/>

            </form-bean>

      </form-beans>    

      <global-exceptions></global-exceptions>  

      <global-forwards>

            <forward name="fail" path="/fail.do"/>

      </global-forwards>     

      <action-mappings>

            <action path="" type="" name=""   ></action>

      </action-mappings>     

      <controller processorClass=""/>    

      <message-resources parameter="" /> 

      <plug-in></plug-in>

</struts-config>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值