上一页 1 2 3 4 5 6 7 8 9 ··· 21 下一页

Servlet实现文件上传,可多文件上传

摘要: 一、Servlet实现文件上传,需要添加第三方提供的jar包下载地址:1)commons-fileupload-1.2.2-bin.zip :点击打开链接2) commons-io-2.3-bin.zip : 点击打开链接 接着把这两个jar包放到 lib文件夹下:二:文件上传的表单提交方式必须是POST方式,编码类型:enctype="multipart/form-data",默认是application/x-www-form-urlencoded比如:<form action="FileUpLoad"enctype="multipar 阅读全文
posted @ 2012-04-30 19:47 spring学习笔记 阅读(22199) 评论(0) 推荐(0) 编辑

java例程练习(File类)

摘要: import java.io.File; import java.io.IOException; public class TestFile { public static void main(String[] args) { String separator = File.separator; String fileName = "myfile.txt"; String directory = "mydir1" + separator + "mydir2"; File f = new File(directory, fileName 阅读全文
posted @ 2012-04-30 19:35 spring学习笔记 阅读(193) 评论(0) 推荐(0) 编辑

java例程练习(Math类)

摘要: public class Test { public static void main(String[] args) { double a = Math.random(); double b = Math.random(); System.out.println(Math.sqrt(a*a+b*b)); System.out.println(Math.pow(a, 8)); System.out.println(Math.round(b)); System.out.println(Math.log(Math.pow(Math.E, 15))); double d ... 阅读全文
posted @ 2012-04-30 19:08 spring学习笔记 阅读(209) 评论(0) 推荐(0) 编辑

java例程练习(将string转成double)

摘要: public class Test { public static void main(String[] args) { String s = "1,2;3,4,5;6,7,8"; double [][] d; String [] sFirst = s.split(";"); d = new double[sFirst.length][]; for(int i = 0; i < sFirst.length; i++) { String [] sSecond = sFirst[i].split(","); d[i] = new d 阅读全文
posted @ 2012-04-30 16:26 spring学习笔记 阅读(880) 评论(0) 推荐(0) 编辑

java例程练习(基础数据类型的包装类)

摘要: public class Test { public static void main(String[] args) { Integer i = new Integer(100); Double d = new Double("123.456"); int j = i.intValue() + d.intValue(); float f = i.floatValue() + d.floatValue(); System.out.println(j); System.out.println(f); double pi = Double.parseDoub... 阅读全文
posted @ 2012-04-30 16:00 spring学习笔记 阅读(177) 评论(0) 推荐(0) 编辑

java例程练习(StringBuffer类)

摘要: public class TestBuffer {//StringBuffer存储变长的字符序列 ,String类是不可变长的字符序列 public static void main(String[] args) { String s = "Mircosoft"; char [] c = {'a', 'b', 'c'}; StringBuffer sb1 = new StringBuffer(s); sb1.append('/').append("IBM").append('/ 阅读全文
posted @ 2012-04-30 15:40 spring学习笔记 阅读(255) 评论(0) 推荐(0) 编辑

java例程练习(计算子串个数)

摘要: public class Test { public static void main(String[] args) { String s = "sunjavahahajavaokjavamyjavagoodjava"; String sToFind = "java"; int count = 0; int index = s.indexOf(sToFind); if(index != -1) { count ++; } s = s.substring(index + sToFind.length()); while(s.indexOf... 阅读全文
posted @ 2012-04-30 14:55 spring学习笔记 阅读(309) 评论(0) 推荐(0) 编辑

java例程练习(统计字母数字等字符的个数)

摘要: public class Test { public static void main(String[] args) { //String s = "48WERSFas!@#"; String s = "23479odurqjPOWUER00*)*&)(#084234-9LRWEJRLJ5R2)*q#)*puFOURoupPU_(*"; int countNum = 0; int countUpperCase = 0; int countLowerCase = 0; int countOther = 0; char[] sc = new char 阅读全文
posted @ 2012-04-30 14:17 spring学习笔记 阅读(255) 评论(0) 推荐(0) 编辑

java例程练习(String类的一些常用方法)

摘要: //String类常用方法集锦public class TestString { public static void main(String[] args) { String s1 = "sun java"; String s2 = "Sun Java"; //取字符 System.out.println(s1.charAt(1));//u //长度 System.out.println(s2.length());//8 //子串位置 System.out.println(s1.indexOf("java"));//4 System 阅读全文
posted @ 2012-04-30 13:21 spring学习笔记 阅读(175) 评论(0) 推荐(0) 编辑

java例程练习(String类对象相等问题)

摘要: public class Test { public static void main(String[] args) { String s1 = "hello"; String s2 = "world"; String s3 = "hello"; System.out.println(s1 == s3); //true System.out.println(s1.equals(s3));//true s1 = new String("hello"); s2 = new String("hello" 阅读全文
posted @ 2012-04-30 11:13 spring学习笔记 阅读(169) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 21 下一页