锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
聽聽聽聽聽聽
org.springframework.web.struts.ActionSupport 綾繪彁渚涗簡涓涓猤etWebApplicationContext() 鏂規硶錛屽彲鐢ㄤ簬鎵嬪姩鍒涘緩涓涓?Spring 鐜銆?/p>
聽聽聽聽聽聽 榪欑鏂瑰紡寰堢畝鍗曞茍涓旀槗浜庣悊瑙c備絾灝?Struts Action涓?Spring 妗嗘灦鑰﹀悎鍦ㄤ竴璧楓傚鏋滄兂鏇挎崲鎺? Spring錛岄偅涔堝繀欏婚噸鍐欎唬鐮併? 騫朵笖錛岀敱浜?Struts Action涓嶅湪 Spring 鐨勬帶鍒朵箣涓嬶紝鎵浠ュ畠涓嶈兘鑾峰緱 Spring AOP 鐨勪紭鍔褲傚綋浣跨敤澶氶噸鐙珛鐨?Spring 鐜鏃訛紝榪欑鏂瑰紡鍙兘鏈夌敤錛? 浣嗘槸鍦ㄥぇ澶氭暟鎯呭喌涓嬶紝榪欑鏂規硶涓嶅鍙﹀涓ょ鏂規硶鍚堥傘?/p>
聽
2銆佽鐩?RequestProcessor
(紺轟緥涓嬭澆
)
聽聽聽聽聽聽 浣跨敤 org.springframework.web.struts.DelegatingRequestProcessor 綾繪潵瑕嗙洊 Struts
鐨?RequestProcessor 澶勭悊紼嬪簭錛屽彲灝?Spring 浠?Struts Action 涓垎紱誨嚭鏉ャ傚湪struts-config涓殑閰嶇疆濡備笅錛?/p>
<controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor"/> <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"> <set-property property="csntextConfigLocation" value="/WEB-INF/beans.xml"/> </plug-in>
聽聽聽聽聽聽 浼樼偣鏄敱浜?Struts Action 娉ㄦ剰涓嶅埌 Spring 鐨勫瓨鍦紝鎵浠ヤ笉闇瑕侀噸鍐?Struts 浠g爜灝卞彲浠ヤ嬌鐢ㄥ叾浠栨帶鍒跺弽杞鍣ㄦ潵鏇挎崲鎺? Spring銆?/p>
聽
聽
3銆佸皢Action綆$悊濮旀墭緇橲pring (紺轟緥涓嬭澆 )
聽聽聽聽聽聽 閫氳繃鍦╯truts-config涓敞鍐孉ction鏃朵嬌鐢╫rg.springframework.web.struts.DelegatingActionProxy綾繪潵瀹炵幇錛岃鏂瑰紡鐨勪紭鐐瑰涓嬶細
聽聽聽聽聽聽聽聽聽聽聽聽 a)錛氭病鏈?Spring 鐨勮瘽錛屾墍鏈夌殑 Struts 鍔ㄤ綔閮藉繀欏繪槸綰跨▼瀹夊叏鐨勩傚鏋滆緗?<bean> 鏍囪鐨?singleton 灞炴犅?涓衡渇alse鈥濓紝閭d箞涓嶇鐢ㄤ綍縐嶆柟娉曪紝搴旂敤紼嬪簭閮藉皢鍦ㄦ瘡涓涓姹備笂鏈変竴涓柊鐢熸垚鐨勫姩浣滃璞°?br>
聽聽聽聽聽聽聽聽聽聽聽聽 b)錛氬彲浠ュ埄鐢?Spring 鐨勭敓鍛藉懆鏈熸柟娉曘備緥濡傦紝褰撳疄渚嬪寲 Struts 鍔ㄤ綔鏃訛紝<bean> 鏍囪鐨?init-method 灞炴?琚敤浜庤繍琛屼竴涓柟娉曘傜被浼煎湴錛屽湪浠庡鍣ㄤ腑鍒犻櫎 bean 涔嬪墠錛宒estroy-method 灞炴ф墽琛屼竴涓柟娉曘傝繖浜涙柟娉曟槸綆$悊鏄傝吹瀵硅薄鐨勫ソ鍔炴硶錛屽畠浠互涓縐嶄笌 Servlet 鐢熷懡鍛ㄦ湡鐩稿悓鐨勬柟寮忚繘琛岀鐞嗐?br>
聽聽聽聽聽聽聽聽聽聽聽聽聽 c)錛歋truts Action涓嶄簡瑙?Spring錛屼笉瀵逛唬鐮佷綔浠諱綍鏀瑰彉灝卞彲鐢ㄤ簬闈?Spring 搴旂敤紼嬪簭涓俁equestProcessor 鐨勬敼鍙樹笉浼氬獎鍝嶅畠錛屽茍涓斿畠鍙互鍒╃敤 Spring AOP 鐗規х殑浼樼偣銆?/p>
宸叉湁 0 浜哄彂琛ㄧ暀璦錛岀寷鍑?>>榪欓噷<<-鍙備笌璁ㄨ
JavaEye鎺ㄨ崘
package
{
import flash.display.Sprite;
import mx.controls.DataGrid;
public class RowColorDataGrid extends DataGrid
{
public function RowColorDataGrid()
{
super();
}
override protected function drawRowBackground(s:Sprite,rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void{
if(dataIndex<super.dataProvider.length){
super.drawRowBackground(s, rowIndex, y, height, 0x49FFAD, dataIndex);
}else{
super.drawRowBackground(s, rowIndex, y, height, color, dataIndex);
}
}
}
}
<?xml version="1.0"?>鏂囩珷鏉ユ簮:http://probe.javaeye.com/blog/481709
<!-- DataGrid control example. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:probe="*">
<mx:XMLList id="employees">
<employee>
<name>Christina Coenraets</name>
<phone>555-219-2270</phone>
<email>ccoenraets@fictitious.com</email>
<active>true</active>
</employee>
<employee>
<name>Joanne Wall</name>
<phone>555-219-2012</phone>
<email>jwall@fictitious.com</email>
<active>true</active>
</employee>
<employee>
<name>Maurice Smith</name>
<phone>555-219-2012</phone>
<email>maurice@fictitious.com</email>
<active>false</active>
</employee>
<employee>
<name>Mary Jones</name>
<phone>555-219-2000</phone>
<email>mjones@fictitious.com</email>
<active>true</active>
</employee>
</mx:XMLList>
<mx:Panel title="琛岀潃鑹睤ataGrid" height="100%" width="100%"
paddingTop="10" paddingLeft="10" paddingRight="10">
<probe:RowColorDataGrid id="dg" width="100%" height="100%" rowCount="5" dataProvider="{employees}">
<probe:columns>
<mx:DataGridColumn dataField="name" headerText="Name"/>
<mx:DataGridColumn dataField="phone" headerText="Phone"/>
<mx:DataGridColumn dataField="email" headerText="Email"/>
</probe:columns>
</probe:RowColorDataGrid>
<mx:Form width="100%" height="100%">
<mx:FormItem label="Name">
<mx:Label text="{dg.selectedItem.name}"/>
</mx:FormItem>
<mx:FormItem label="Email">
<mx:Label text="{dg.selectedItem.email}"/>
</mx:FormItem>
<mx:FormItem label="Phone">
<mx:Label text="{dg.selectedItem.phone}"/>
</mx:FormItem>
</mx:Form>
</mx:Panel>
</mx:Application>
<?xml version="1.0"?>鏂囩珷鏉ユ簮:http://probe.javaeye.com/blog/481686
<!-- Simple example to demonstrate the LineChart and AreaChart controls. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var expensesAC:ArrayCollection = new ArrayCollection( [
{ Month: "Jan", Wage: 2000, Fine: 100},
{ Month: "Feb", Wage: 1000, Fine: 50},
{ Month: "Mar", Wage: 1500, Fine: 70},
{ Month: "Apr", Wage: 1800, Fine: 30},
{ Month: "May", Wage: 2400, Fine: 50} ]);
]]>
</mx:Script>
<mx:SolidColor id="sc1" color="blue" alpha=".3"/>
<mx:Stroke id = "s1" color="blue" weight="2"/>
<mx:Panel title="LineChart and AreaChart Controls Example"
height="100%" width="100%" layout="horizontal">
<mx:LineChart id="linechart" height="100%" width="100%"
paddingLeft="5" paddingRight="5"
showDataTips="true" dataProvider="{expensesAC}">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="Month"/>
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis id="first" minimum="0" maximum="200"/>
</mx:verticalAxis>
<mx:secondVerticalAxis>
<mx:LinearAxis id="second" minimum="500" maximum="3000"/>
</mx:secondVerticalAxis>
<mx:series>
<mx:LineSeries verticalAxis="{first}" yField="Fine" form="curve" displayName="Fine"/>
<mx:ColumnSeries verticalAxis="{second}" yField="Wage" displayName="Wage" stroke="{s1}" fill="{sc1}"/>
</mx:series>
</mx:LineChart>
</mx:Panel>
</mx:Application>