- 浏览: 324528 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
ajax忘了跳转:
谢谢分享,基于你的思路。我改良了一版,可供参考public s ...
一个整数的所有最小因子 -
baobaodehao1991:
楼主,合并多列,单元格内容并不能居中,选中合并的单元格,除了前 ...
把table表格内容导出为excel -
lbaaixy:
楼主,小弟最近也在弄这个东西。有点小问题java.lang.C ...
flex + red5实现视频会议 -
weilikk:
好像只能替换整行,如果是一行中有其他数据,只替换行中某个位置就 ...
poi替换模板标签为图片 -
chinaxiaofeng8:
在吗,兄弟,你那个代码怎么运行看效果的
flex + red5实现视频会议
remoteObject和java交互的时候需要在remoting-config.xml文件中配置,用httpservice和java交互的时候需要在struts文件中配置action或者在web.xml中配置servlet。httpservice在与action或者servlet交互的时候是可以获取request对象的,所以httpservice可以代替所有remoteObject实现的方法,而remoteObject却不能代替httpservice实现的方法。
下面来一个httpservice和java交互的例子。
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:ns1="iman.sps.component.*"
preloader="iman.sps.asfile.MyProgressBar"
creationComplete="bind()"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" width="100%" height="100%">
<fx:Style source="../cssfile/forms.css"/>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<s:Animate id="bounceEffect" target="{dg}" repeatCount="1" repeatBehavior="reverse" disableLayout="true" duration="1000">
<s:motionPaths>
<s:SimpleMotionPath property="y" valueFrom="{dg.y+10}" valueTo="{dg.y}">
</s:SimpleMotionPath>
<s:SimpleMotionPath property="alpha" valueFrom="0" valueTo="1">
</s:SimpleMotionPath>
</s:motionPaths>
</s:Animate>
<!-- <s:RemoteObject id="allSheet" destination="getAllDoBaseSheet" result="resultHandler(event)"/>-->
<mx:HTTPService
id="allSheet"
method="POST"
url="../../sps/sheet/getAllDoBaseSheet.action"
result="resultHandler(event)"
fault="allSheet_faultHandler(event)"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.adobe.serialization.json.JSON;
import mx.binding.utils.BindingUtils;
import mx.binding.utils.ChangeWatcher;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.ListEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
[Bindable]
public var ac:ArrayCollection = null;
[Bindable]
private var sheetid:String=null;
private var stuMarkDataArray:ArrayCollection;
[Bindable]
private var workItemId:String = null;
[Bindable]
private var spsCurrentState:String = null;
[Bindable]
private var processDefId:String=null;
[Bindable]
private var activityDefId:String=null;
public function get _processDefId():String{
return processDefId;
}
public function set _processDefId(str:String):void{
processDefId=str;
}
public function get _activityDefId():String{
return activityDefId;
}
public function set _activityDefId(str:String):void{
activityDefId=str;
}
public function get _sheetid():String{
return sheetid;
}
public function set _sheetid(str:String):void{
sheetid=str;
}
public function get _workItemId():String{
return workItemId;
}
public function set _workItemId(str:String):void{
workItemId=str;
}
public function get _spsCurrentState():String{
return spsCurrentState;
}
public function set _spsCurrentState(str:String):void{
spsCurrentState=str;
}
protected function show(event:Event):void
{
bounceEffect.end();
bounceEffect.play();
}
private function toUrl(event:Event):void{
trace("1111");
}
private function init():void{
dg.addEventListener(ListEvent.ITEM_CLICK,handleClickPlay);
}
public function bind():void{
allSheet.send();
init();
}
private function resultHandler(event:ResultEvent):void {
var rawData:String = event.result as String;
trace(rawData);
var rawArray:Array = JSON.decode(rawData) as Array;
stuMarkDataArray = new ArrayCollection(rawArray);
dg.dataProvider = stuMarkDataArray;
// ac = ArrayCollection(event.result);
// dg.dataProvider = ac;
}
private function handleClickPlay(event:ListEvent):void {
//此处得到选中行的对象 selectedItem 返回Object
var obj:Object = (event.currentTarget as DataGrid).selectedItem;
//拿具体值 可根据具体的 dataField 取得 下面是循环拿所有的方法 供参考
// var arr:Array =(event.currentTarget as DataGrid).columns
// for (var i:uint = 0; i < arr.length; i++) {
// var tempCol:DataGridColumn = (event.currentTarget as DataGrid).columns as DataGridColumn;
// trace("属性:"+tempCol.dataField+ " = " + obj[tempCol.dataField]);
// }
// Alert.show(obj.id)
sheetid=(obj.sheetId) as String;
trace("sheetid="+sheetid);
workItemId = (obj.workItemId) as String;
spsCurrentState = (obj.currentState) as String;
activityDefId = (obj.activityDefId) as String;
processDefId = (obj.processDefId) as String;
}
public function label1_clickHandler(event:MouseEvent):void
{
//调用URL
if(this._sheetid!=null){
var url:String="../../sps/sheet/undoSheetDetail.action?sheetId="+ this._sheetid+"&workItemId="+this._workItemId+"¤tState="+this._spsCurrentState;
url += "&processDefId="+this._processDefId+"&activityDefId="+this._activityDefId;
trace("外部参数="+sheetid);
trace("url="+url);
// Alert.show(url);
var javaeyeUrl:URLRequest = new URLRequest(url);
navigateToURL(javaeyeUrl,"_self");
var n:Object = event.currentTarget as Object;
}
}
public function label1_mouseOverHandler(event:MouseEvent):void
{
var la:Label = event.currentTarget as Label;
la.styleName= "cLable";
}
public function label1_mouseOutHandler(event:MouseEvent):void
{
var la:Label = event.currentTarget as Label;
la.styleName= "aLable";
}
protected function allSheet_faultHandler(event:FaultEvent):void
{
Alert.show("调用失败");
}
]]>
</fx:Script>
<mx:Panel title="待办工单" backgroundColor="#D4E1F2" width="100%" height="100%">
<s:VGroup width="100%" height="100%">
<s:HGroup horizontalAlign="right" width="100%">
<mx:Button label="查询"/>
<mx:Button label="清空"/>
</s:HGroup>
<s:HGroup width="100%">
<mx:Form width="80%">
<mx:Grid width="99%">
<mx:GridRow width="100%" >
<mx:GridItem width="40%" horizontalAlign="left" verticalAlign="middle" >
<mx:FormItem label="工单号" indicatorGap="25" width="100%">
<mx:TextInput width="60%" />
</mx:FormItem>
</mx:GridItem>
<mx:GridItem width="60%" horizontalAlign="left" verticalAlign="middle">
<mx:FormItem label="工单类型" indicatorGap="25" width="100%">
<mx:TextInput width="40%" />
</mx:FormItem>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow width="100%" >
<mx:GridItem width="40%" horizontalAlign="left" verticalAlign="middle" >
<mx:FormItem label="主 题" indicatorGap="25" width="100%">
<mx:TextInput width="60%" />
</mx:FormItem>
</mx:GridItem>
<mx:GridItem width="60%" horizontalAlign="left" verticalAlign="middle">
<mx:FormItem label="派单时间" indicatorGap="25" width="100%" direction="horizontal" >
<mx:DateField width="48%" textAlign="center" formatString="YYYY-MM-DD"/>
<mx:Label text="至" width="4%"/>
<mx:DateField width="48%" textAlign="center" formatString="YYYY-MM-DD"/>
</mx:FormItem>
</mx:GridItem>
</mx:GridRow>
</mx:Grid>
</mx:Form>
</s:HGroup>
<s:HGroup width="100%" height="80%">
<mx:DataGrid id="dg" width="100%" doubleClickEnabled="true" doubleClick="label1_clickHandler(event)" creationComplete="show(event)" height="100%">
<mx:columns >
<mx:DataGridColumn id="sheetId" headerText="ID" dataField="id" visible="false">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="工单号" dataField="sheetId">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="主题" dataField="title">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="工单类型" dataField="type">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn id="sheetStep" headerText="当前环节" dataField="currentState">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="派单时间" dataField="createTime">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="要求完成时间" dataField="createTime">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="派单部门" dataField="createUser">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</s:HGroup>
<!-- <ns1:PagingBar width="100%" id="myPageBar" >
</ns1:PagingBar> -->
</s:VGroup>
</mx:Panel>
</s:Application>
struts配置
<action name="getAllDoBaseSheet" class="baseSheetAction" method="getAllDoBaseSheet">
java代码
该action实现了ServletRequestAware,ServletResponseAware接口
public void getAllDoBaseSheet() throws Exception{
String account = this.getSessionValue(SessionUtil.accountName);
String userName = this.getSessionValue(SessionUtil.userName);
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8;");
log.info("查询代办工单方法执行了");
try{
baseSheetDtolist = baseSheetService.getAllDoBaseSheet(account,userName);
}catch(Exception e){
e.printStackTrace();
}
StringBuffer josn = new StringBuffer();
josn.append("[");
if(baseSheetDtolist!=null && baseSheetDtolist.size()>0){
for(int i=0;i<baseSheetDtolist.size();i++){
BaseSheetDto bsd = (BaseSheetDto)baseSheetDtolist.get(i);
if(i!=baseSheetDtolist.size()-1){
josn.append("{");
josn.append("\"id\":\""+ bsd.getId()+"\",");
josn.append("\"createTime\":\""+ DateTools.convertDateToString(bsd.getCreateTime(), "yyyy-MM-dd")+"\",");
josn.append("\"createUser\":\""+ bsd.getCreateUser()+"\",");
josn.append("\"sheetId\":\""+ bsd.getSheetId()+"\",");
josn.append("\"title\":\""+ bsd.getTitle()+"\",");
josn.append("\"step\":\""+ bsd.getStep()+"\",");
josn.append("\"workItemId\":\""+ bsd.getWorkItemId()+"\",");
log.info(bsd.getProcessDefId());
josn.append("\"processDefId\":\""+ bsd.getProcessDefId()+"\",");
josn.append("\"activityDefId\":\""+ bsd.getActivityDefId()+"\",");
josn.append("\"processInstId\":\""+ bsd.getProcessInstId()+"\",");
josn.append("\"currentState\":\""+ bsd.getCurrentState()+"\"},");
}else{
josn.append("{");
josn.append("\"id\":\""+ bsd.getId()+"\",");
josn.append("\"createTime\":\""+ DateTools.convertDateToString(bsd.getCreateTime(), "yyyy-MM-dd")+"\",");
josn.append("\"createUser\":\""+ bsd.getCreateUser()+"\",");
josn.append("\"sheetId\":\""+ bsd.getSheetId()+"\",");
josn.append("\"title\":\""+ bsd.getTitle()+"\",");
josn.append("\"step\":\""+ bsd.getStep()+"\",");
josn.append("\"workItemId\":\""+ bsd.getWorkItemId()+"\",");
josn.append("\"processDefId\":\""+ bsd.getProcessDefId()+"\",");
josn.append("\"activityDefId\":\""+ bsd.getActivityDefId()+"\",");
josn.append("\"processInstId\":\""+ bsd.getProcessInstId()+"\",");
josn.append("\"currentState\":\""+ bsd.getCurrentState()+"\"}");
}
}
}
josn.append("]");
log.info(josn.toString());
PrintWriter out = response.getWriter();
out.print(josn.toString());
}
下面来一个httpservice和java交互的例子。
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:ns1="iman.sps.component.*"
preloader="iman.sps.asfile.MyProgressBar"
creationComplete="bind()"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" width="100%" height="100%">
<fx:Style source="../cssfile/forms.css"/>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<s:Animate id="bounceEffect" target="{dg}" repeatCount="1" repeatBehavior="reverse" disableLayout="true" duration="1000">
<s:motionPaths>
<s:SimpleMotionPath property="y" valueFrom="{dg.y+10}" valueTo="{dg.y}">
</s:SimpleMotionPath>
<s:SimpleMotionPath property="alpha" valueFrom="0" valueTo="1">
</s:SimpleMotionPath>
</s:motionPaths>
</s:Animate>
<!-- <s:RemoteObject id="allSheet" destination="getAllDoBaseSheet" result="resultHandler(event)"/>-->
<mx:HTTPService
id="allSheet"
method="POST"
url="../../sps/sheet/getAllDoBaseSheet.action"
result="resultHandler(event)"
fault="allSheet_faultHandler(event)"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.adobe.serialization.json.JSON;
import mx.binding.utils.BindingUtils;
import mx.binding.utils.ChangeWatcher;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.ListEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
[Bindable]
public var ac:ArrayCollection = null;
[Bindable]
private var sheetid:String=null;
private var stuMarkDataArray:ArrayCollection;
[Bindable]
private var workItemId:String = null;
[Bindable]
private var spsCurrentState:String = null;
[Bindable]
private var processDefId:String=null;
[Bindable]
private var activityDefId:String=null;
public function get _processDefId():String{
return processDefId;
}
public function set _processDefId(str:String):void{
processDefId=str;
}
public function get _activityDefId():String{
return activityDefId;
}
public function set _activityDefId(str:String):void{
activityDefId=str;
}
public function get _sheetid():String{
return sheetid;
}
public function set _sheetid(str:String):void{
sheetid=str;
}
public function get _workItemId():String{
return workItemId;
}
public function set _workItemId(str:String):void{
workItemId=str;
}
public function get _spsCurrentState():String{
return spsCurrentState;
}
public function set _spsCurrentState(str:String):void{
spsCurrentState=str;
}
protected function show(event:Event):void
{
bounceEffect.end();
bounceEffect.play();
}
private function toUrl(event:Event):void{
trace("1111");
}
private function init():void{
dg.addEventListener(ListEvent.ITEM_CLICK,handleClickPlay);
}
public function bind():void{
allSheet.send();
init();
}
private function resultHandler(event:ResultEvent):void {
var rawData:String = event.result as String;
trace(rawData);
var rawArray:Array = JSON.decode(rawData) as Array;
stuMarkDataArray = new ArrayCollection(rawArray);
dg.dataProvider = stuMarkDataArray;
// ac = ArrayCollection(event.result);
// dg.dataProvider = ac;
}
private function handleClickPlay(event:ListEvent):void {
//此处得到选中行的对象 selectedItem 返回Object
var obj:Object = (event.currentTarget as DataGrid).selectedItem;
//拿具体值 可根据具体的 dataField 取得 下面是循环拿所有的方法 供参考
// var arr:Array =(event.currentTarget as DataGrid).columns
// for (var i:uint = 0; i < arr.length; i++) {
// var tempCol:DataGridColumn = (event.currentTarget as DataGrid).columns as DataGridColumn;
// trace("属性:"+tempCol.dataField+ " = " + obj[tempCol.dataField]);
// }
// Alert.show(obj.id)
sheetid=(obj.sheetId) as String;
trace("sheetid="+sheetid);
workItemId = (obj.workItemId) as String;
spsCurrentState = (obj.currentState) as String;
activityDefId = (obj.activityDefId) as String;
processDefId = (obj.processDefId) as String;
}
public function label1_clickHandler(event:MouseEvent):void
{
//调用URL
if(this._sheetid!=null){
var url:String="../../sps/sheet/undoSheetDetail.action?sheetId="+ this._sheetid+"&workItemId="+this._workItemId+"¤tState="+this._spsCurrentState;
url += "&processDefId="+this._processDefId+"&activityDefId="+this._activityDefId;
trace("外部参数="+sheetid);
trace("url="+url);
// Alert.show(url);
var javaeyeUrl:URLRequest = new URLRequest(url);
navigateToURL(javaeyeUrl,"_self");
var n:Object = event.currentTarget as Object;
}
}
public function label1_mouseOverHandler(event:MouseEvent):void
{
var la:Label = event.currentTarget as Label;
la.styleName= "cLable";
}
public function label1_mouseOutHandler(event:MouseEvent):void
{
var la:Label = event.currentTarget as Label;
la.styleName= "aLable";
}
protected function allSheet_faultHandler(event:FaultEvent):void
{
Alert.show("调用失败");
}
]]>
</fx:Script>
<mx:Panel title="待办工单" backgroundColor="#D4E1F2" width="100%" height="100%">
<s:VGroup width="100%" height="100%">
<s:HGroup horizontalAlign="right" width="100%">
<mx:Button label="查询"/>
<mx:Button label="清空"/>
</s:HGroup>
<s:HGroup width="100%">
<mx:Form width="80%">
<mx:Grid width="99%">
<mx:GridRow width="100%" >
<mx:GridItem width="40%" horizontalAlign="left" verticalAlign="middle" >
<mx:FormItem label="工单号" indicatorGap="25" width="100%">
<mx:TextInput width="60%" />
</mx:FormItem>
</mx:GridItem>
<mx:GridItem width="60%" horizontalAlign="left" verticalAlign="middle">
<mx:FormItem label="工单类型" indicatorGap="25" width="100%">
<mx:TextInput width="40%" />
</mx:FormItem>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow width="100%" >
<mx:GridItem width="40%" horizontalAlign="left" verticalAlign="middle" >
<mx:FormItem label="主 题" indicatorGap="25" width="100%">
<mx:TextInput width="60%" />
</mx:FormItem>
</mx:GridItem>
<mx:GridItem width="60%" horizontalAlign="left" verticalAlign="middle">
<mx:FormItem label="派单时间" indicatorGap="25" width="100%" direction="horizontal" >
<mx:DateField width="48%" textAlign="center" formatString="YYYY-MM-DD"/>
<mx:Label text="至" width="4%"/>
<mx:DateField width="48%" textAlign="center" formatString="YYYY-MM-DD"/>
</mx:FormItem>
</mx:GridItem>
</mx:GridRow>
</mx:Grid>
</mx:Form>
</s:HGroup>
<s:HGroup width="100%" height="80%">
<mx:DataGrid id="dg" width="100%" doubleClickEnabled="true" doubleClick="label1_clickHandler(event)" creationComplete="show(event)" height="100%">
<mx:columns >
<mx:DataGridColumn id="sheetId" headerText="ID" dataField="id" visible="false">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="工单号" dataField="sheetId">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="主题" dataField="title">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="工单类型" dataField="type">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn id="sheetStep" headerText="当前环节" dataField="currentState">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="派单时间" dataField="createTime">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="要求完成时间" dataField="createTime">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="派单部门" dataField="createUser">
<mx:itemRenderer>
<fx:Component>
<mx:Label toolTip="双击查看工单" doubleClickEnabled="true" doubleClick="outerDocument.label1_clickHandler(event)">
</mx:Label>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</s:HGroup>
<!-- <ns1:PagingBar width="100%" id="myPageBar" >
</ns1:PagingBar> -->
</s:VGroup>
</mx:Panel>
</s:Application>
struts配置
<action name="getAllDoBaseSheet" class="baseSheetAction" method="getAllDoBaseSheet">
java代码
该action实现了ServletRequestAware,ServletResponseAware接口
public void getAllDoBaseSheet() throws Exception{
String account = this.getSessionValue(SessionUtil.accountName);
String userName = this.getSessionValue(SessionUtil.userName);
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8;");
log.info("查询代办工单方法执行了");
try{
baseSheetDtolist = baseSheetService.getAllDoBaseSheet(account,userName);
}catch(Exception e){
e.printStackTrace();
}
StringBuffer josn = new StringBuffer();
josn.append("[");
if(baseSheetDtolist!=null && baseSheetDtolist.size()>0){
for(int i=0;i<baseSheetDtolist.size();i++){
BaseSheetDto bsd = (BaseSheetDto)baseSheetDtolist.get(i);
if(i!=baseSheetDtolist.size()-1){
josn.append("{");
josn.append("\"id\":\""+ bsd.getId()+"\",");
josn.append("\"createTime\":\""+ DateTools.convertDateToString(bsd.getCreateTime(), "yyyy-MM-dd")+"\",");
josn.append("\"createUser\":\""+ bsd.getCreateUser()+"\",");
josn.append("\"sheetId\":\""+ bsd.getSheetId()+"\",");
josn.append("\"title\":\""+ bsd.getTitle()+"\",");
josn.append("\"step\":\""+ bsd.getStep()+"\",");
josn.append("\"workItemId\":\""+ bsd.getWorkItemId()+"\",");
log.info(bsd.getProcessDefId());
josn.append("\"processDefId\":\""+ bsd.getProcessDefId()+"\",");
josn.append("\"activityDefId\":\""+ bsd.getActivityDefId()+"\",");
josn.append("\"processInstId\":\""+ bsd.getProcessInstId()+"\",");
josn.append("\"currentState\":\""+ bsd.getCurrentState()+"\"},");
}else{
josn.append("{");
josn.append("\"id\":\""+ bsd.getId()+"\",");
josn.append("\"createTime\":\""+ DateTools.convertDateToString(bsd.getCreateTime(), "yyyy-MM-dd")+"\",");
josn.append("\"createUser\":\""+ bsd.getCreateUser()+"\",");
josn.append("\"sheetId\":\""+ bsd.getSheetId()+"\",");
josn.append("\"title\":\""+ bsd.getTitle()+"\",");
josn.append("\"step\":\""+ bsd.getStep()+"\",");
josn.append("\"workItemId\":\""+ bsd.getWorkItemId()+"\",");
josn.append("\"processDefId\":\""+ bsd.getProcessDefId()+"\",");
josn.append("\"activityDefId\":\""+ bsd.getActivityDefId()+"\",");
josn.append("\"processInstId\":\""+ bsd.getProcessInstId()+"\",");
josn.append("\"currentState\":\""+ bsd.getCurrentState()+"\"}");
}
}
}
josn.append("]");
log.info(josn.toString());
PrintWriter out = response.getWriter();
out.print(josn.toString());
}
发表评论
-
amf协议
2011-12-09 09:06 1130AMF协议的最基本概念则是在XML的文本数据中了解到的。随 ... -
flex + red5实现视频会议
2011-09-30 10:55 25541公司最近要在系统中加视频会议的功能,让我探索,我 ... -
可以动态添加行背景色的flex datagrid控件
2011-08-26 23:31 3282flex自带的datagrid控件是不能改变行的背景色的,项目 ... -
flex为datagrid数据添加序号
2011-08-24 12:10 1353protected function getRowNum( ... -
页面的flex与div遮罩效果及输入法问题
2011-07-05 20:57 3938Flex嵌入到HTML中切换焦点不能输入中文和遮盖DIV的问题 ... -
flex的label换行
2011-05-10 21:00 1105在as中赋值 label.text="aaaaa \ ... -
as3和flex的100条知识
2011-05-10 19:27 1447AS3和Flex一百条常用的知 ... -
一个flex进度条
2011-05-04 16:09 1809package com.iman.sps.sheet.ascr ... -
解决Error #1502: 脚本的执行时间已经超过了 15 秒的默认超时设置
2011-04-11 19:21 8259js代码: var url; var Addi ... -
as和js互相调用
2011-04-11 18:42 1538as调用js: as代码 ExternalInterfac ... -
【转】flex利用Blazeds上传文件
2011-03-29 12:43 1418Flex 利用 Blazeds上传文件 收藏 ... -
flex界面弹出jsp模态窗口,并向js传值
2011-03-29 12:04 5033最近做的项目需要动态创建弹出窗口,动态创建fle ... -
radioButton切换页签TabNavigator
2011-03-25 12:40 1901<?xml version="1.0" ... -
datagrid中显示带下划线链接的列表数据
2011-03-25 12:37 2499public function linkButtonClick ... -
[转]as和java数据类型转换关系
2011-03-15 16:38 1798使用BlazeDS+JAVA的模式来开发的时候,数据类型对应的 ... -
flex中 类似java instanceof 的用法
2011-03-14 18:46 1566java中有 instanceof 关键字,在actionsc ... -
flex解析xml文件和xml字符串的疑问
2011-03-11 16:44 3193最近在做flex页面 ... -
flex的httpservice与java交互过程中的乱码问题
2011-03-08 13:08 2470写程序这么久了,以为自己早已告别了乱码问题,可是最近在做fle ... -
为SSH架构的java web项目添加flex支持
2011-02-11 15:43 3711java+flex开发环境在此不再介绍,SSH架构 ... -
flex的滤镜
2011-02-10 14:34 1995flex可以通过滤镜增加图片效果,这里以模糊效果为例进行演示: ...
相关推荐
在Flex4中,RemoteObject是ActionScript 3.0中的一种重要组件,它允许与后端服务器进行数据交互,如处理业务逻辑、访问数据库等。在这个"flex4 remoteobject 多文件上传的例子"中,我们将重点探讨如何使用...
### Flex中RemoteObject与Java的通信 在Flex开发过程中,实现客户端与服务器端的数据交互是一项基本而又关键的任务。其中,`RemoteObject`是Adobe Flex框架提供的一个强大的组件,它允许Flex应用程序通过AMF...
在Flex中访问RemoteObject实例涉及以下知识点: 1. **ActionScript 3.0**:Flex的主要编程语言是ActionScript 3.0,它是基于ECMAScript的一个面向对象的语言。在Flex中,我们通过编写ActionScript代码来实现业务...
在本文中,我们将深入探讨如何使用Flex中的RemoteObject组件封装后与Java应用程序进行通信。RemoteObject是Adobe Flex框架的一部分,它允许Flex客户端与服务器端的业务逻辑进行交互,通常是通过AMF(Action Message ...
Flex是Adobe Flex框架的一部分,它是一个用于构建富互联网应用程序(RIA)的开源开发工具。在Flex中,RemoteObject是ActionScript类,它...熟悉并掌握RemoteObject的使用,将有助于提升你在Flex开发中的效率和能力。
### Flex中ActionScript动态调用RemoteObject类 在Flex中,使用ActionScript动态调用RemoteObject类是一种常见的实现客户端与服务器端交互的方式。通过这种方式,开发者可以在客户端灵活地调用服务器端的服务,并...
`RemoteObject` 可以方便地将Flex应用程序中的ActionScript方法映射到服务器上的业务逻辑方法,从而实现数据的传递和交换。以下将详细讲解如何使用`RemoteObject`以及它的工作原理。 1. **配置Flex项目** 在Flex...
一个用Flex调用JAVA方法的例子ffffffff
在Flex开发中,为了实现客户端(Flex应用)与服务器端(通常是Java应用)的数据交互,开发者经常使用`RemoteObject`组件。本篇文章将深入探讨如何使用`RemoteObject`与Java进行JSON格式的数据交换,以便更好地理解和...
通过本教材,学习者将掌握如何创建Flex项目,理解Flex在Web工程中的应用,以及如何利用HTTPService和RemoteObject与服务器进行数据交互,从而实现富互联网应用的功能。同时,提供的参考资料和安装文件将有助于实际...
在Flex项目中使用RemoteObject,首先需要在MXML文件中声明一个RemoteObject实例,例如: ```xml <mx:RemoteObject id="ro" destination="HelloWorld"> ``` 这里的`id`属性定义了引用该RemoteObject实例的变量名,`...
在Flex和Java的集成应用中,RemoteObject是关键的通信组件,它允许Flex客户端与Java后台服务进行数据交换。 RemoteObject是Flex框架中的一个关键组件,它通过AMF(Action Message Format)协议,提供了一种高效、轻...
eclipse3.7 + flash builder 4.5插件 + tomcat6.X调试通过,一个flex remoteobject简单例子(BlazeDS)。实际导入后指定flex server--java settings--blazeds.war的路径
在本文中,我们将深入探讨如何使用Flex 4与Java进行通信,并通过三种不同的方法实现这一目标:RemoteObject、HTTPService和WebService。 1. Flex与普通Java类通信:RemoteObject RemoteObject是Flex中用于与远程...
在本实例中,我们探讨了三种Flex4与Java交互的方式:通过RemoteObject、HTTPService以及WebService。 1. Flex 与普通 Java 类通信 - RemoteObject 在Flex中,RemoteObject组件用于与Java服务端的普通类进行通信。...
接着,在Flex项目中,通过Flex的RemoteObject或HTTPService组件来调用Spring服务,实现客户端和服务器之间的通信。 总的来说,Flex与Spring的联合开发提供了前后端分离、高效通信的解决方案,适用于需要构建富用户...
6. **Flex的RemoteObject和HTTPService**:如何使用这两个组件来与后端服务通信,包括配置和数据传递。 7. **Web应用程序架构**:讨论如何在Flex和ExtJS之间划分前端和后端职责,以及如何设计合理的通信模式。 深入...
在与Flex3的集成中,可能需要设计一套数据访问接口,使Flex客户端能通过RemoteObject调用这些接口来读取、更新和删除数据。 在实际项目中,"MANAGER"可能是一个目录或者文件,它可能包含了项目的管理相关的代码或者...
RemoteObject是Adobe Flex框架中的一个特性,允许在客户端(如Flash Player)和服务器端之间进行透明的RPC(远程过程调用)通信。 在Flex应用中,RemoteObject是客户端与服务器交互的关键组件,它提供了与服务器...