index.jsp

来自「J2EE独立开发制作」· JSP 代码 · 共 89 行

JSP
89
字号

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>开发语言调查</title>
</head>

<body>
<%@ page contentType="text/html;charSet=gb2312"%> 
<% 
response.setHeader("Cache-Control","no-store"); 
response.setDateHeader("Expires",0); 
%> 
<%! 
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); 
%> 
<html> 
<head> 
<title></title> 
<link href="css.css" rel="StyleSheet" type="text/css"></link> 
</head> 
<body> 
<table width="180" border="1" bordercolor="#999999"> 
<tr> 
<td align=center>WEB开发语言调查</td> 
</tr> 
<form name=frm method=post action=write.jsp> 
<tr>  
<td> 
<% 
String ss = null; 
for (int i=0;i<4;i++) 
{ 
ss = "<input type=\"radio\" name=\"choice\" value=" + i+">"+"A"+i+"、"+ question[i]+" "+"<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=150 height=100></td> 
</tr> 
</form> 
</table> 
</body> 
</html> 

</body>
</html>

⌨️ 快捷键说明

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