acc
wlcacc
全部博文(170)
FireWorkflow(0)
Oracle(9)
ExtJS(19)
面试题集锦(5)
其他(2)
JavaScript(22)
DIV+CSS(12)
网页制作(0)
网络技术(2)
ASP(1)
Tomcat(1)
OS(0)
DB(0)
Hibernate(5)
Java(0)
Spring(1)
Struts(2)
Fireworks(15)
Windows(7)
Java(30)
MySQL(11)
2014年(7)
2010年(2)
2009年(62)
2008年(25)
2007年(67)
2006年(7)
knife800
alunfirs
格伯纳
Bsolar
浪花小雨
chengccy
qingfeng
laishiwa
Iqcw1368
分类: Java
2007-10-28 15:18:52
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%><%@ page import="java.io.*"%><% Random random = new Random(); String sRand=""; int j=0; String outPut ="D:\\acc\\"; StringBuffer ab = new StringBuffer(); for(j=1;j<=10;j++){ for (int i=0;i<6;i++){ String rand=String.valueOf(random.nextInt(10)); sRand+=rand; } ab.append(sRand+"\n"); sRand=""; } try{ File temp = new File(outPut,"random.txt"); DataOutputStream outs = new DataOutputStream( new FileOutputStream(temp)); outs.write(ab.toString().getBytes()); outs.close(); }catch(Exception e){ e.printStackTrace(); }%>
//读文件
<%@ page contentType="text/html; charset=GBK" %><%@ page import="java.io.*"%><% try{ //取得当前目录路径 String strPath = request.getRealPath(""); //建立FileReader对象 FileReader fr = new FileReader(strPath + "\\scroll.txt"); //建立BufferedReader对象 BufferedReader br = new BufferedReader(fr); //从文件读取一行字符串 String Line = br.readLine(); //判断读取到的字符串是否不为空 String strNews = ""; while(Line != null){ strNews += Line + ""; Line = br.readLine(); } br.close(); fr.close();%><html><head><title>读取滚动新闻</title></head><body bgcolor="#ffffff"><marquee style="color:#000000;font-size:12px;line-height:20px;" direction="up" height="70" scrollamount="1" scrolldelay="100" onMouseOver="this.scrollDelay=500" onMouseOut="this.scrollDelay=1"><%=strNews%></marquee></body></html><% }catch(Exception e){ e.printStackTrace(); }%>
上一篇:window.open()的所有参数列表
下一篇:JSP中REQUEST详解
登录 注册