易截截图软件、单文件、免安装、纯绿色、仅160KB

JSP对文件的操作

一、在JSP页面中读取本地文件内容:
<%
    try {
        BufferedReader in = new BufferedReader(new FileReader("D:/test.txt"));
        String file = "";
        String temp = "";
        while((temp=in.readLine())!=null) {
            file += temp + "<br>";
        }
        out.println(file);
        in.close();
        out.flush();
        } catch(Exception e) {
        e.printStackTrace();
        }
%>
 
二、在JSP页面中写入文件内容:
    <%
    try {
        PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter("D:/test.txt", true)));
        writer.write(content);
        writer.close();
        out.println("已经写入到文件中");
        } catch(Exception e) {
        e.printStackTrace();
        }
    %>


相关文档:

iframe嵌入jsp不变形

有的时候会忘记,记录一下:
<iframe id="xx" name="xx" width="515" height="177" scrolling="no" border="0" marginwidth="0" marginheight="0"  frameborder="0" src="Xx.jsp"></iframe>
要使jsp不变形,主要是marginwidth="0" marginheight="0"两个属性。 ......

Jsp中的Exception对象

     Exception对象是用来处理Jsp页面文件在执行时所有发生的错误和异常;Jsp页面文件必须在isErrorPage=true的情况下才可以使用该对象;该对象一般配合Page指令一起使用,通过指定某个页面为错误处理页面,把所有的错误都集中到那个页面进行处理,可以使整个系统的性能得到加强;常用方法如下
getMes ......

JSP内置对象

jsp内置对象
  定义:可以不加声明就在JSP页面脚本(Java程序片和Java表达式)中使用的成员变量
  JSP共有以下9种基本内置组件(可与ASP的6种内部组件相对应):
  
内置对象
代表内容
范围
request
触发服务调用的请求
request
response
对请求的应答
page
session
为请求的客户创建的sessio ......

Google App Engine: RUN JSP ERROR

I used Eclipse to try the google app engine demo project: guestbook.
when i create a *.jsp file in the WAR directory,the error information appear:
"Your Web Application Project must be configured to use a JDK in order to use JSPs."
solution:
It is because Eclipse put the JRE to the JRE directory ......

水晶易表—JSP—数据库

水晶易表毕竟是做报表的,离开数据库它是飞不远的。从目前的版本来看,易表连接数据库虽然有好几种方式,但都比较麻烦,而且还有很多局限性。其中通过xml方式连接数据库还算比较灵活,我要说的就是这种方式。
 
在易表的数据管理里新建一个xml数据连接,如下图:
我的是英文版的,不好意思,以前是中文版来着,后来 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号