java从数据库查询结果显示在网页上,步骤如下:第一步:连接数据库,并取得查询结果:import java.sql.*; 2.在JSP上显示可以用EL表达式如${user.getName()},也可以用JAVA胸本,或都直接用out.print(user.getName());

使用包装类型转换即可,代码如下:
convert即是所求,转换完成。
可以通过BufferedReader 流的形式进行流缓存,之后通过readLine方法获取到缓存的内容。 BufferedReader bre = null;try {String file = "D:/test/test.txt"
;//此时获取到的bre就是整个文件的缓存流while ((str = bre.readLine())!= null) // 判断最后一行不存在,为空结束循环{System.out.println(str)
;//原样输出读到的内容(unicode会自动转换为中文的)};备注:unicode不需要转换的,直接输出即可,会自动变成中文,如:System.out.println("\u0061\u0062\u6c49\u5b57")
使用java的IO流对图片进行二进制读取操作即可
示例为:读取图片为二进制流,并写入到其他图片中
static void testCopyImage(){ File source=new File("E:\\share\\Wallpaper\\Bliss.jpg"); File desk=new File("d:\\images"); if(!desk.exists()){ desk.mkdir(); } try { FileInputStream inputStream=new FileInputStream(source); FileOutputStream outputStream=new FileOutputStream(new File("d:/images/Bliss.jpg")); int ch=inputStream.read(); while(ch!=-1){ outputStream.write(ch); ch=inputStream.read(); } inputStream.close(); outputStream.close(); System.out.println("图片复制成功!"); } catch (FileNotFoundException e) { System.out.println("文件不存在:"+e.getMessage()); } catch (IOException e) { System.out.println("文件读取错误:"+e.getMessage()); } }