?? vote.jsp
字號:
<html>
<head>
<title>投票統計</title>
</head>
<%@ page contentType="text/html; charset=gb2312"%>
<body>
<center><h2>
投票統計
</h2></center>
<%
response.setHeader("Cache-Control","no-store");
response.setDateHeader("Expires",0);
%>
<%!
//getQuestion(String)函數用來獲得文本文件中的問題
public String[] getQuestion(String s)
{
String[] strQ = new String[4];
String strTemp = null;
int i;
java.io.RandomAccessFile rf = null;
try {
rf = new java.io.RandomAccessFile(s,"r");
} catch(Exception e)
{
System.out.println(e);
System.exit(0);
}
for(i=0;i<4;i++)
{
try {
strTemp = rf.readLine();
}catch(Exception e)
{
strTemp = "None Question";
}
if(strTemp==null)
strTemp = "None Question";
strQ[i]= strTemp;
}
return strQ;
}
%>
<%
String s = null;
String[] question = new String[4];
s=request.getRealPath("question.txt");
question = getQuestion(s);
%>
<h3>您最擅長制作什么類型的動態網頁?</h3>
<table width="80%" border="0" align="center">
<form name=frm method=post action=writefl.jsp>
<tr>
<td>
<%
String ss=null;
for (int i=0;i<4;i++)
{
String ques=new String(question[i].getBytes("ISO8859_1"),"GBK");
ss="<input type=\"radio\" name=\"choice\" value="+i+">"+(char)('A'+i)+". "+ques+"<br><br>";
out.println(ss);
}
%>
</td>
</tr>
<tr>
<td align=center><input type="submit" value="我投一票"></td>
</tr>
<tr>
<td align=center><img src="/servlet/VoteImage" width=180 height=120> </td>
</tr>
</form>
</table>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -