Image processing operations in jsp

Source: Internet
Author: User
Tags stmt
<% @ Page contentType = "text/html; charset = gb2312" %>
<% @ Page import = "java. SQL. *, java. io. *, java. awt. Image, java. awt. image. *, com.sun.image.codec.jpeg. *" %>
<Html>
<Body>
<%
/*
Drop table imagetable;
Create table imagetable
(
Nid int not null,
Image blob,
Primary key (nid)
)
Type = InnoDB;
*/
/*
// ========================= 1. Write the file to the large field of the database and begin in ============ ==============
Class. forName ("org. gjt. mm. mysql. Driver"). newInstance ();
String url = "jdbc: mysql: // localhost: 3306/test? User = root & password = eastsoftweb ";
Connection conn = DriverManager. getConnection (url );
Java. io. File file = new File ("d:/temp/1.jpg ");
FileInputStream is = new FileInputStream (file );
PreparedStatement stmt = conn. prepareStatement (
"Insert into imagetable (nid, image)" +
"VALUES (?, ?) "); // Pre-compiled SQL statements
Stmt. setInt (1, 1 );
Stmt. setBinaryStream (2, is, (int) file. length ());
Stmt.exe cuteUpdate ();
Stmt. close ();
Is. close ();
Out. println ("update end ");
// ======================== Write the file into the large field of the database end ==================== ================
*/
/*
// ======================================= 2. jsp display server hard disk image example begin ========== ========
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.