rollnews.jsp

来自「网上购物系统 使用structs access 实现」· JSP 代码 · 共 39 行

JSP
39
字号
<%@ 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 + "<br>";
    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();
  }
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?