📄 editvote.jsp
字号:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.text.NumberFormat,java.util.*"%>
<%@ page import="com.wxpn.tutorial.servlet.*"%>
<%if (session.getAttribute("userName") == null) {
response.sendRedirect("/Vote/admin/login.jsp");
}%>
<%//从form1表单选项个数中获取n值,如果没有就给一个默认值4
String n = request.getParameter("n");
if (n == null) {
n = "4";
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加投票项目</title>
<link rel="stylesheet" type="text/css" href="STYLE.CSS">
</head>
<body>
<%NumberFormat nf = NumberFormat.getPercentInstance();
Question question = (Question) request.getAttribute("question");
Collection c = question.getItems();
Date startTime = question.getStartime();
Date endTime = question.getEndtime();
Calendar startCalendar = Calendar.getInstance();
startCalendar.setTime(startTime);
Calendar endCalendar = Calendar.getInstance();
endCalendar.setTime(endTime);
%>
<table width="100%" border="0" align="center" cellpadding="0"
cellspacing="1" bgcolor="#000000">
<tr>
<td width="" height="30" bgcolor="#F0F0F0">
<table width="100%" border="0">
<tr>
<td width="300"> >>修改投票</td>
<td width="200"><a href="/Vote/admin/index.jsp">首页</a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="746" height="349" bgcolor="#F0F0F0">
<form method="POST" action="/Vote/EditVoteServlet" name="form1">
<table width="70%" height="224" border="0" align="center"
cellpadding="0" cellspacing="1" bgcolor="#999999">
<tr>
<td width="100%" height="18" bgcolor="#F0F0F0"></td>
</tr>
<tr>
<td height="25" bgcolor="#F0F0F0">主题: <%=question.getTitle()%></td>
</tr>
<tr>
<td height="25" bgcolor="#F0F0F0">选项:</td>
</tr>
<%if ((c != null)) {
Iterator iterator = c.iterator();
int i = 1;
Item item = null;
while (iterator.hasNext()) {
item = (Item) iterator.next();
%>
<tr>
<td align="left" bgcolor="#F0F0F0">[<%=i%>] <%=item.getOptions()%></td>
</tr>
<%i++;
}
}%>
<tr>
<td height="25" bgcolor="#F0F0F0">方式: <%=question.getStyle().equals("radio") ? "单选" : "多选"%></td>
</tr>
<tr>
<td height="25" bgcolor="#F0F0F0">开始时间: <select size="1"
name="startyear">
<option value="<%=startCalendar.get(Calendar.YEAR)%>" selected><%=startCalendar.get(Calendar.YEAR)%></option>
<%for (int i = 6; i < 10; i++) {
out.println("<option value=200" + i + ">200" + i + "</option>");
}
%>
</select>年<select size="1" name="startmonth">
<option value="<%=startCalendar.get(Calendar.MONTH)+1%>" selected><%=startCalendar.get(Calendar.MONTH) + 1%></option>
<%for (int i = 2; i < 13; i++) {
out.println("<option value=" + i + ">" + i + "</option>");
}
%>
</select>月<select size="1" name="startday">
<option value="<%=startCalendar.get(Calendar.DAY_OF_MONTH)%>"
selected><%=startCalendar.get(Calendar.DAY_OF_MONTH)%></option>
<%for (int i = 2; i < 32; i++) {
out.println("<option value=" + i + ">" + i + "</option>");
}
%>
</select>日 </td>
</tr>
<tr>
<td height="25" bgcolor="#F0F0F0">结束时间: <select size="1"
name="endyear">
<option value="<%=endCalendar.get(Calendar.YEAR)%>" selected><%=endCalendar.get(Calendar.YEAR)%></option>
<%for (int i = 6; i < 10; i++) {
out.println("<option value=200" + i + ">200" + i + "</option>");
}
%>
</select>年<select size="1" name="endmonth">
<option value="<%=endCalendar.get(Calendar.MONTH)+1%>" selected><%=endCalendar.get(Calendar.MONTH) + 1%></option>
<%for (int i = 2; i < 13; i++) {
out.println("<option value=" + i + ">" + i + "</option>");
}
%>
</select>月<select size="1" name="endday">
<option value="<%=endCalendar.get(Calendar.DAY_OF_MONTH)%>"
selected><%=endCalendar.get(Calendar.DAY_OF_MONTH)%></option>
<%for (int i = 2; i < 32; i++) {
out.println("<option value=" + i + ">" + i + "</option>");
}
%>
</select>日 </td>
</tr>
<tr>
<td height="25" bgcolor="#F0F0F0">当前调查项目?<input type="radio"
name="active" value="1"
<%=question.getActive()==1? "checked" : ""%>>是 <input name="active"
type="radio" value="0" <%=question.getActive()==0? "checked" : ""%>>否
</td>
</tr>
<tr>
<td height="25" align="center" bgcolor="#F0F0F0">
<input type="hidden" value="<%=question.getId()%>" name="id">
<input type="submit" value="提交" name="B1"> <input
type="reset" value="取消" name="B2"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -