我做的是个拍照功能想通过flex把jsp传过来的参数经过flex传到servlet里(图片也一样),加断点也进不去servlet里,具体代码
出错代码:
错误:[RPC Fault faultString="HTTP 请求错误" faultCode="Server.Error.Request" faultDetail="错误:[IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032"]. URL: http://localhost:8080/Flex/PhotoServlet"]
flex代码:简写
- HTML code
//保存 private function SavePicture():void { var width:Number,height:Number; if(t_vd_Video.visible == true){ width=m_localVideo.width; height=m_localVideo.height; }else{ width=m_localVideo1.width; height=m_localVideo1.height; } t_ban_Save.enabled = false; m_pictureData = ""; for(var i:int = 0; i < width; i++) { for(var j:int = 0; j < height; j++) { if(m_pictureData.length > 0) { m_pictureData += "," + m_pictureBitmapData.getPixel32(i,j).toString(); } else { m_pictureData = m_pictureBitmapData.getPixel32(i,j).toString(); } } } var params:URLVariables = new URLVariables(); params.width = width; params.height = height; params.bitmap_data = m_pictureData; params.id = idzd; params.workid = workidf; params.dm = dmf; //Alert.show("错误:"+width+"=="+height); t_ws_getFiles.send(params); } <mx:HTTPService id="t_ws_getFiles" url="http://localhost:8080/FlexHttpService/onLineTakePhotoServlet" showBusyCursor="true" method="POST" useProxy="false" result="__onGetFilesResult(event)" fault="__onGetFilesFault(event)"/> <mx:Panel x="205" y="34" width="629" height="487" layout="absolute" title="视频拍照" fontSize="12"> <mx:VideoDisplay id="t_vd_Video" width="600" height="400" x="12" y="9" /> <mx:VideoDisplay id="t_vd_Video1" width="600" height="400" x="12" y="9" visible="false"/> <mx:ControlBar horizontalAlign="right"> <mx:TextInput width="160" x="327" text="http://localhost:8080" id="txt_http"/> <mx:Button id="t_btn_Shooting" label="拍照" click="SnapshotPicture()"/> </mx:ControlBar> </mx:Panel> <mx:Panel id="t_panel_Picture" x="180" y="5" width="629" height="487" layout="absolute" title="拍照图片" fontSize="12" visible="false"> <mx:Image id="t_img_Picture" x="13" y="5" width="600" height="400"/> <mx:ControlBar horizontalAlign="right"> <mx:Button id="t_ban_Save" label="保存" click="SavePicture()" /> <mx:Button id="t_ban_Canel" label="取消" click="CanelPicture()" /> </mx:ControlBar> </mx:Panel>
servlet代码:
- Java code
response.setContentType("text/html;charset=UTF-8"); response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-cache"); response.setDateHeader("Expires", 0); String id="",workid="",dm=""; String bitmap_data = request.getParameter("bitmap_data"); int width = Integer.parseInt(request.getParameter("width")); int height = Integer.parseInt(request.getParameter("height")); id = request.getParameter("id"); workid = request.getParameter("workid"); dm = request.getParameter("dm"); System.out.println(id+"====="+workid+"====="+dm);