<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 56, comments - 54, trackbacks - 0, articles - 4
       ::  ::  :: 聯系 :: 聚合  :: 管理
    STRUTS的 ActionForm到現在為止,出現了最少三種方式: 普通的,動態的和懶的.

    所以你在你自已的開發中,可以有很多選擇,如果你安全第一,可以用普通的.如果你更喜歡XML,則用動態的.

    如果你很懶,那就用Lazy ActionForm.? available in Version 1.2.6 onwards

    STRUTS提供的這三種ActionForm方式,要實際應用中你只要選擇一種就可以了.

    下面說說Lazy ActionForm:?

    如果你喜歡STRUTS的強大的功能的特性(就比如這個ActionForm有多種選擇),又喜歡快捷, Lazy ActionForm對你來說是一個好消息. 這個有點類似于WW2中值得稱道的一個特性,可以減少編寫ActionForm的麻煩.(STRUTS正在把WW2中好的東西都吸收進來了,難怪這兩個東西以后會合并為STRUTS IT).

    示例代碼如下:

    struts-config.xml配置
    <struts-config>?

    ? <form-beans>?
    ?????<form-bean name="lazyForm" type="org.apache.struts.validator.LazyValidatorForm"/>?
    ??</form-beans>?

    ??<action-mappings>?
    ? ??<action path="/myActionPath" type="myPackage.MyAction" name="lazyForm" validate="true"/>?
    ??</action-mappings>

    </struts-config>
    JSP網頁
    <html:form action="/myActionPath">?

    ? <h2>Simple Property Example</h2>
    ? ? ? ? ?
    ? ? ? ? ? Customer Number: <html:text property="custNo"/>
    ? ? ? ? ? Customer Name:? ?<html:text property="custName"/>?

    ? <h2>Mapped Property Example</h2>
    ? ? ? ? ?
    ? ? ? ? ? Street:? <html:text property="address(street)"/>
    ? ? ? ? ? Town:? ? <html:text property="address(town)"/>
    ? ? ? ? ? State:? ?<html:text property="address(state)"/>
    ? ? ? ? ? Country: <html:text property="address(country)"/>?

    ? <h2>Indexed Property Example</h2>?
    ??????????
    ? <logic:iterate id="products" property="products">?
    ????Product Code:<html:text name="products" property="code" indexed="true"/>?
    ????Product Description:<html:text name="products" property="description" indexed="true"/>?
    ????Product Price:<html:text name="products" property="price"?indexed="true"/>?
    ? </logic:iterate>

    </html:form>
    action調用
    java代碼:?
    public ActionForward execute(ActionMapping mapping,
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ActionForm form,
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?HttpServeletRequest request,
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?HttpServletResponse response)throwsException{?
    ????// Cast form to DynaBean?
    ????DynaBean dynaForm = (DynaBean)form;?

    ????// Use the DynaBean?
    ????String custNo = (String)dynaForm.get("custNo");? ?// simple?
    ????Map address? ?= (Map)dynaForm.get("address");? ? ?// mapped?
    ????List products = (List)dynaForm.get("products");? ?// indexed??
    ????//... etc
    }
    在ACTION中,你可以使用 BeanUtils 1.7.0的特性,把dynaForm一次性拷貝到HIBERNATE的POJO中去!

    轉載地址:http://forum.javaeye.com/viewtopic.php?t=17441
    主站蜘蛛池模板: 亚洲精品国产美女久久久| 亚洲国产精品无码久久久久久曰 | 女性无套免费网站在线看| 久久亚洲成a人片| 最好免费观看高清在线| 亚洲精品亚洲人成在线观看| 国产精品免费大片一区二区| 国产亚洲成归v人片在线观看| 黄视频在线观看免费| 精品国产_亚洲人成在线高清| 免费网站观看WWW在线观看| 国产亚洲精品自在久久 | 久久国产精品免费视频| 亚洲免费视频在线观看| 4虎1515hh永久免费| 亚洲高清免费在线观看| 免费精品国产自产拍在| 亚洲av日韩专区在线观看| 免费人成视频在线观看视频| 国产精品hd免费观看| 亚洲尹人香蕉网在线视颅 | 国产成人一区二区三区免费视频 | 国产黄色免费观看| 亚洲韩国—中文字幕| 亚洲天堂免费在线| 老司机午夜性生免费福利| 亚洲开心婷婷中文字幕| 亚欧在线精品免费观看一区| 亚洲欧美自偷自拍另类视| 亚洲国产精品无码久久久久久曰| 久久狠狠躁免费观看2020| 亚洲av片不卡无码久久| 免费大学生国产在线观看p| a毛片全部免费播放| 亚洲不卡在线观看| 亚洲成?Ⅴ人在线观看无码| 热re99久久6国产精品免费| 亚洲AV色欲色欲WWW| 亚洲va久久久噜噜噜久久天堂| 毛片a级三毛片免费播放| www在线观看播放免费视频日本|