Binary picture stream for Java background processing database

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.