📄 modquestion.jsp
字号:
<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>
<%@page contentType="text/html;charset=GB2312"%>
<%@include file="opendata.jsp"%>
<%@include file="check.jsp"%>
<%!
int isempty(String str) //判断递交的字符串是否为空
{
if(str.length() ==0)
return (0);
else return (1);
}
%>
<%!
String transfer(int i) //将时间数值转换为标准格式
{
if(i>=10)
return (String.valueOf(i));
else return ("0"+String.valueOf(i));
}
%>
<%
String question = request.getParameter("question");
int questionid = Integer.parseInt(request.getParameter("questionid"));
int year,month,day,hour,minute,second;
String time;
GregorianCalendar calendar;
calendar = new GregorianCalendar();
year = calendar.get(Calendar.YEAR);
month = calendar.get(Calendar.MONTH)+1;
day = calendar.get(Calendar.DAY_OF_MONTH);
hour = calendar.get(Calendar.HOUR_OF_DAY);
minute = calendar.get(Calendar.MINUTE);
second = calendar.get(Calendar.SECOND);
time = year +"-"+transfer(month)+"-" + transfer(day) +" "+transfer(hour)+":"+transfer(minute)+":"+transfer(second);
if(question.length()==0)
{
String errmsg = "问题不可为空!!!";
out.print("<center><font color=green size=5>错误信息<hr></font><font color=red>"+errmsg+"</font><hr>");
out.print("<input type=button value=回上一页 onclick=history.back()>");
}
else
{
//更新主题
sql = "update Questions set Question = '"+question+"',Date = '"+time+"',IsVisable = 0 where QuestionID = "+questionid;
smt.executeUpdate(sql);
response.sendRedirect("edit.jsp?questionid="+questionid);
}
%>
<html>
<title>错误信息</title>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -