Interface
PublicInputStream Loadinvoicerider (String invoice_id_); Implementation Layer @Override Publicinputstream Loadinvoicerider (String invoice_id_) {String sql= "Select Rider_ from mp_invoice where invoice_id_ =?"; returnMpjdbctemplate.queryforobject (SQL,NewObject[] {invoice_id_},NewRowmapper<inputstream>() { PublicInputStream Maprow (ResultSet RS,intRowNum)throwsSQLException {returnRs.getbinarystream (1); } }); }
Control layer @RequestMapping (value= "Loadinvoicerider") Public voidLoadinvoicerider (String invoice_id_, httpservletrequest request, httpservletresponse response, HttpSession session) {Map<string, object> result =NewHashmap<string, object>(); Try{Getoperator (request, session); InputStream InputStream=Invoiceservice.loadinvoicerider (INVOICE_ID_); Response.reset (); Servletoutputstream out=Response.getoutputstream (); byte[] content =New byte[65535]; intLength = 0; if(InputStream! =NULL) { while(length = inputstream.read (content))! =-1) {out.write (content,0, length); }} out.flush (); Out.close (); Log ("Admin", "Invoicecontroller.loadinvoicerider", Invoice_id_, "0",NULL, request, session); } Catch(Exception e) {logger.error (E.getmessage (), E); Result.put ("Message", GetErrorMessage (e, request)); Result.put ("Success",false); StringWriter StringWriter=NewStringWriter (); E.printstacktrace (NewPrintWriter (StringWriter)); Log ("Admin", "Invoicecontroller.loadinvoicerider", Invoice_id_, "1", stringwriter.tostring (), request, session); } }
The front desk directly places the requested address in the SRC location of the picture.
{xtype:' Actioncolumn ', Width:280, Dataindex:' Invoice_id_ ', Text:' <spring:message code= ' INVOICE '/> ', align:' Center ', renderer:function(value, MetaData, record) {varID =metaData.record.id; Ext.defer (function() {ext.create (' Ext.img ', {height:140, Width:250, src: ' Loadinvoicerider.do? Invoice_id_= ' + value, renderto:id, listeners: { Scope: This, el: {dblclick:function(E, a) {varWinviewimage = ext.create (' Ext.window '), {width:750, Height:500, maximizable:true,//Form Maximize buttonTitle: ' <spring:message code= ' image '/> ', layout:"Fit",//Window Layout TypeModal:true,//modal window, default = FalseResizable:false,//Resizing a formCloseaction: ' Hide ',//closing a form is actually a hidden form that is not closed destroy this form object (conserve resources)Plain:true,//form body part background color transparentDraggable:true,//fill-in drag formborder:false, items: [Ext.create (' Ext.img ', {width:750, Height:500, SRC:' Loadinvoicerider.do? Invoice_id_= ' +value}) ] }); Winviewimage.show (); } } } }) }, 50); returnExt.String.format (' <div id= ' {0} ' ></div> ', id); } },
Binary picture stream for Java background processing database