云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > jsp实验报告

jsp实验报告

  • 62 次阅读
  • 3 次下载
  • 2025/7/2 5:16:23

{

byte bb[]=str.getBytes(\ str=new String(bb);

%>

read.jsp

<%@ page contentType=\<%@ taglib tagdir=\

读取文件:

<%

String condition=request.getParameter(\ if(condition!=null) { %>

<% } %>


Write.tag

<%@ variable name-given=\<%@ tag pageEncoding=\<%@ tag import=\

<%@ attribute name=\

<% File dir=new File(\ dir.mkdir();

File f=new File(dir,\ try {

FileWriter outfile=new FileWriter(f);

BufferedWriter bufferout=new BufferedWriter(outfile); char a[]=content.toCharArray(); for(int i=0;i

jspContext.setAttribute(\文件加密成功\ }

catch(IOException e) {

jspContext.setAttribute(\文件加密失败\ } %>

Read.tag

<%@ tag pageEncoding=\<%@ tag import=\

<%@ attribute name=\

<%@ variable name-given=\<% File dir=new File(\ File f=new File(dir,\

StringBuffer mess=new StringBuffer(); String str; try {

FileReader in=new FileReader(f) ;

BufferedReader bufferin=new BufferedReader(in); String temp;

while((temp=bufferin.readLine())!=null) mess.append(temp); bufferin.close(); in.close();

str=new String(mess);

if(method.equals(\

jspContext.setAttribute(\ else if(method.equals(\ {

char a[]=str.toCharArray(); for(int i=0;i

jspContext.setAttribute(\ } else

jspContext.setAttribute(\ }

catch(IOException e) {

jspContext.setAttribute(\ } %>

inputContent.jsp页面

write.jsp页面

read.jsp页面

五、实验结果分析:

1、FileInputStream流和FileReader流都是顺序的读取文件,只要不关闭流。每次调用read方法就顺利的读取源中其余的内容,直到源的末尾或流被关闭。两者的区别是Fileinputstream流以字节为单位读取文件,FileReader流以字符为单位读取文件。

2、FileOutStream流和FileReader流都是顺序的写文件,只要不关闭文件,每次调用write方法就顺序的向输出流写入内容,直到流被关闭。二者的区别是FileOutStream流以字节为单位读取文件,FileReader流以字符为单位读取文件。

实验3 使用数据流读写Java数据

一、实验目的

本实验的目的是掌握使用数据流读写Java数据。 二、实验要求

编写两个JSP页面writeData.jsp和readData.jsp。 三、实验内容

1)writeData.jsp页面使用Java程序片将一个int型数据、一个long型数据、一个char型数据、一个String型数据和一个double型数据写入到名字为javaData.data的文件中。

2)readData.jsp页面读取javaData.data文件中的数据并显示出来。 四、实验结果

writeData.jsp页面

搜索更多关于: jsp实验报告 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

{ byte bb[]=str.getBytes(\ str=new String(bb); %>

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com