我对 JSP 和 HTML 比较陌生。我被要求为我在 Perl 中的某个项目制作一个 GUI。但是,我对容器有疑问。基本上,每个容器都以单选按钮的形式显示从文件中读取的结果。它工作正常,但突然间,其中一个容器开始消失。任何帮助将不胜感激。
提前致谢 :)
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" import="java.io.*, java.net.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Bi-Grams</title>
<style type="text/css">
body {background-color:white;}
h3{color:black}
</style>
</head>
<body>
<h3>Tri-Grams of 13th Jan 2013 USA</h3>
<div id="content1" style="background-color:#EEEEEE;height:400px;width:400px;overflow:auto;border:2px solid;">
<form>
<%
int i=0;
String line = null;
String []line_parts;
request.setCharacterEncoding("UTF-8");
FileReader fis = new FileReader("/home/jones/testing/trigram-topics-13th.txt");
BufferedReader br = new BufferedReader(fis);
while(br.readLine() != null){
%>
<input type="radio" name="event_number" value="<%out.println(i);%>" >
<%
line = br.readLine();
line_parts = line.split(" ");
out.println(line_parts[0]);
%>
<br>
<%
i++;
}
br.close();
%>
</form>
</div>
<br/>
<h3>Tri-Grams of 14th Jan 2013 USA</h3>
<div id="content2" style="background-color:#EEEEEE;height:400px;width:400px;overflow:auto;border:2px solid;">
<form>
<%
request.setCharacterEncoding("UTF-8");
fis = new FileReader("/home/jones/testing/trigram-topics-14th.txt");
br = new BufferedReader(fis);
while(br.readLine() != null){
%>
<input type="radio" name="event_number" value="<%out.println(i);%>">
<%
line = br.readLine();
line_parts = line.split(" ");
out.println(line_parts[0]);
%>
<br>
<%
i++;
}
br.close();
%>
</form>
</div>
</body>
</html>