Struts1中的<form-bean>和<action-mapping>属性

1.<form-bean>

Contains form bean definitions. The Form beans create ActionForm instances at runtime. The details of each form bean are provided in the <form-bean> element. The <form-property> elements within the form bean contain the property names and the property types of the form bean.

 

Attributes of <form-bean> are:

  • name : Must have a unique bean name. This name is used as reference in the action mappings. Often, this is also the  name of the request or the session attribute under which the form is stored.

  • type : The value is a fully-qualified classname of the ActionForm class used with the form bean.

Attributes of <form-property> are:

  • name : Contains the name of a property of the form bean.

  • type : Contains the property type such as String, String[], etc.

Example Entry

 

<form-bean name="EventCVForm" type="org.apache.struts.validator.DynaValidatorForm">

  <form-property name="cvName" type="java.lang.String"/>

  <form-property name="severity" type="java.lang.String[]"/>

  ......

</form-bean>

2.action-mapping

Contains the action definitions. Each action mapping is defined in an <action> element. The <forward> definition within <action> , maps the result of the action to the jsp page invoked. This is a 'local' forward and is optional. That is, for the particular request object, if there is no forward defined in the global forwards, it is specified in the <action-mapping> element.

Attributes of <action-mappings> are:

  • path : Contains the name of the request received

  • type : Contains the name of the action class invoked

  • scope : Specifies the scope in which the Controller (ActionServlet) must look for the bean

Attributes of (local) <forward> within <action-mappings> are the same as that of the global <forward>.

Example Entry

 

<action-mappings>

<action path="/NetworkEvent"

            type="com.adventnet.nms.webclient.fault.event.EventViewAction"

            scope="request">

        <forward name="eventView" path="NetworkEventPage" contextRelative="true"/>

</action>

</action-mappings>

 

In the above entry, when a request matching the specified path (NetworkEvent) is received, an instance of the ActionClass is created. The controller looks for the bean in the specified scope (request) creating and saving a bean of the specified class, if needed. The ActionForward object is returned and the reference to the object is acquired using mapping.findforward .. The layout for the page displaying network events is defined in the corresponding tiles definition file, where the page components and the corresponding JSPs are specified.

更多Struts1中的struts-config.xml属性可以连接:

http://www.webnms.com/webnms/help/developer_guide/web_client/web_struts_config.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值