Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Thursday, May 5, 2011

Wednesday, May 4, 2011

Java Gson

http://code.google.com/p/google-gson/

Save RequestStream to file

DataInputStream dataStream = new DataInputStream(req.getInputStream());
byte datas[] = new byte[formDataLength];
int totalBytes = 0;
while (totalBytes < formDataLength) {
int bytes = dataStream.read(datas, totalBytes, formDataLength);
totalBytes += bytes;
}

saveMp3(datas);

public static void saveFile(byte[] datas) throws Exception{
FileOutputStream fileOutputStream = new FileOutputStream("xxxxx");
fileOutputStream.write(datas);
fileOutputStream.flush();
fileOutputStream.close();
}

Tuesday, May 3, 2011

Java learning

http://ghads.wordpress.com/2008/09/19/create-unique-identifiers-in-java-uuid/

Sunday, May 1, 2011

JSP Installation

Tomcat 7 with Eclipse
Follow the instruction to setup the whole development environment:


==========================================
a. Download Java SE 6 with JDK (If you don't use EJB, you don't need the Java EE version)


b. Installation of Tomcat server

Friday, April 29, 2011

Java store in BLOB

http://www.kodejava.org/examples/279.html


http://www.kodejava.org/browse/55.html

Thursday, April 29, 2010

Good JSP books

Core Servlets and JavaServer Pages
http://pdf.coreservlets.com/

Head First Servlets & JSPs

Monday, April 19, 2010

Convert java.util.Date to java.sql.Date

java.sql.Date sqlDate = new java.sql.Date(new java.util.Date().getTime());

Thursday, March 25, 2010

JSP request.setCharacterEncoding

Today I just find that what I have inserted into database (Chinese characters) is scrambled code.

Finally, the solution is
request.setCharacterEncoding("utf8");

JavaServer Page Implicit Objects

http://www.gulland.com/courses/JavaServerPages/jsp_objects.jsp