📄 nihao_jsp.java
字号:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
public final class nihao_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
String a1,a2,a3,a4,a5,a6,a7;
private static java.util.List _jspx_dependants;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=gb2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
"", true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n");
out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />\r\n");
out.write("<title>无标题文档</title>\r\n");
out.write("<style type=\"text/css\">\r\n");
out.write("<!--\r\n");
out.write("body {\r\n");
out.write("\tbackground-color: #009933;\r\n");
out.write("}\r\n");
out.write(".STYLE1 {\r\n");
out.write("\tfont-size: 18px;\r\n");
out.write("\tfont-weight: bold;\r\n");
out.write("\tcolor: #FF0000;\r\n");
out.write("}\r\n");
out.write(".STYLE2 {color: #FF0000}\r\n");
out.write(".STYLE3 {\r\n");
out.write("\tfont-size: 18px;\r\n");
out.write("\tcolor: #FF0000;\r\n");
out.write("}\r\n");
out.write("-->\r\n");
out.write("</style></head>\r\n");
out.write("\r\n");
out.write("<body>");
out.write("\r\n");
out.write(" ");
request.setCharacterEncoding("gb2312");
String kemu=request.getParameter("kemu");
String time=request.getParameter("time");
String str1=request.getParameter("xuantigan");
String str2=request.getParameter("a");
String str3=request.getParameter("b");
String str4=request.getParameter("c");
String str5=request.getParameter("d");
String str6=request.getParameter("select1");
String str7=request.getParameter("xuanda");
String str8=request.getParameter("select2");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conkemu=DriverManager.getConnection("jdbc:odbc:xing");
String strkemu="insert into a(a,b) values('"+kemu+"','"+time+"')";
if(kemu!=null&&time!=null)
{
Statement sta=conkemu.createStatement();
sta.executeUpdate(strkemu);
sta.close();
conkemu.close();
}
else if(str6.equalsIgnoreCase("删除"))
{
String strxuan="delete from chuti where theme=? and a=? and b=? and c=? and d=?";
PreparedStatement prexuan=conkemu.prepareStatement(strxuan);
prexuan.setString(1,str1);
prexuan.setString(2,str2);
prexuan.setString(3,str3);
prexuan.setString(4,str4);
prexuan.setString(5,str5);
prexuan.executeUpdate();
prexuan.close();
conkemu.close();
}
else if(str6.equalsIgnoreCase("修改"))
{
strkemu="update chuti set theme=? and a=? and b=? and c=? and d=? and correct=? where( theme='"+a1+"'and a='"+a2+"'and b='"+a3+"'and c='"+a4+"'and d='"+a5+"'and correct='"+a6+"')";
PreparedStatement prexuan=conkemu.prepareStatement(strkemu);
prexuan.setString(1,str1);
prexuan.setString(2,str2);
prexuan.setString(3,str3);
prexuan.setString(4,str4);
prexuan.setString(5,str5);
prexuan.setString(6,str6);
prexuan.close();
conkemu.close();
}
}catch(Exception e)
{
out.println(e.getMessage());
}
out.write(" \r\n");
out.write("<td width=\"794\"><table width=\"553\" border=\"0\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td width=\"583\" height=\"36\"><form id=\"form1\" name=\"form1\" method=\"post\" action=\"nihao.jsp\">\r\n");
out.write(" <label>考试科目\r\n");
out.write(" <input type=\"text\" name=\"kemu\" />\r\n");
out.write(" </label>\r\n");
out.write(" <label>考试时间\r\n");
out.write(" <input type=\"text\" name=\"time\" />\r\n");
out.write(" </label>\r\n");
out.write(" <label>\r\n");
out.write(" <input type=\"submit\" name=\"Submit\" value=\"录入\" />\r\n");
out.write(" </label>\r\n");
out.write(" </form> </td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write(" \r\n");
out.write(" <p align=\"left\" class=\"STYLE1\">选择题</p>\r\n");
out.write(" ");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection concon=DriverManager.getConnection("jdbc:odbc:xing");
String strcon="select * from chuti ";
PreparedStatement precon=concon.prepareStatement(strcon);
ResultSet setcon=precon.executeQuery();
while(setcon.next())
{
a1=setcon.getString(1);
a2=setcon.getString(2);
a3=setcon.getString(3);
a4=setcon.getString(4);
a5=setcon.getString(5);
a6=setcon.getString(6);
out.write("\r\n");
out.write(" <form id=\"form2\" name=\"form2\" method=\"post\" action=\"nihao.jsp\">\r\n");
out.write(" <label><span class=\"STYLE2\">题干:</span>\r\n");
out.write(" <input type=\"text\" name=\"xuantigan\" value=");
out.print(a1);
out.write(" />\r\n");
out.write(" </label>\r\n");
out.write(" <p>\r\n");
out.write(" <label><span class=\"STYLE2\">A</span> <input type=\"text\" name=\"a\" value=");
out.print(a2);
out.write(">\r\n");
out.write(" </label>\r\n");
out.write(" </p>\r\n");
out.write(" <p>\r\n");
out.write(" <label><span class=\"STYLE2\">B</span> <input type=\"text\" name=\"b\"value=");
out.print(a3);
out.write(" >\r\n");
out.write(" </label>\r\n");
out.write(" </p>\r\n");
out.write(" <p>\r\n");
out.write(" <label><span class=\"STYLE2\">C </span> <input type=\"text\" name=\"c\" value=");
out.print(a4);
out.write(">\r\n");
out.write(" </label>\r\n");
out.write(" </p>\r\n");
out.write(" <p>\r\n");
out.write(" <label><span class=\"STYLE2\">D</span> <input type=\"text\" name=\"d\" value=");
out.print(a5);
out.write(">\r\n");
out.write(" </label>\r\n");
out.write(" </p>\r\n");
out.write(" <p>\r\n");
out.write(" <label><span class=\"STYLE2\">正确答案</span>\r\n");
out.write(" <input type=\"text\" name=\"xuanda\" value=");
out.print(a6);
out.write(">\r\n");
out.write(" </label>\r\n");
out.write(" </p>\r\n");
out.write(" <p>\r\n");
out.write(" <label>科目\r\n");
out.write(" <input type=\"text\" name=\"kemu\" value=");
out.print(setcon.getString(7));
out.write(">\r\n");
out.write(" </label>\r\n");
out.write(" </p>\r\n");
out.write(" <p>\r\n");
out.write(" <label>\r\n");
out.write(" <select name=\"select1\">\r\n");
out.write(" <option>修改</option>\r\n");
out.write(" <option>删除</option>\r\n");
out.write(" </select>\r\n");
out.write(" </label>\r\n");
out.write(" </p>\r\n");
out.write(" <p>\r\n");
out.write(" <label>\r\n");
out.write(" <input type=\"submit\" name=\"Submit2\" value=\"提交\" />\r\n");
out.write(" </label>\r\n");
out.write(" </p>\r\n");
out.write(" </form>\r\n");
out.write(" ");
}
}catch(Exception e)
{
out.println(e.getMessage());
}
out.write("\r\n");
out.write(" <p class=\"STYLE3\">简答题</p>\r\n");
out.write(" <form id=\"form3\" name=\"form3\" method=\"post\" action=\"\">\r\n");
out.write(" <label><span class=\"STYLE2\">题干<br />\r\n");
out.write(" </span>\r\n");
out.write(" <textarea name=\"textarea\" rows=\"10\"></textarea>\r\n");
out.write(" </label>\r\n");
out.write(" <p>\r\n");
out.write(" <label>正确答案<br />\r\n");
out.write(" <textarea name=\"textarea2\"></textarea>\r\n");
out.write(" </label>\r\n");
out.write(" </p>\r\n");
out.write(" <p>\r\n");
out.write(" <label>科目\r\n");
out.write(" <input type=\"text\" name=\"textfield8\" />\r\n");
out.write(" </label>\r\n");
out.write(" </p>\r\n");
out.write(" <p>\r\n");
out.write(" <label>\r\n");
out.write(" <select name=\"select2\">\r\n");
out.write(" <option>删除</option>\r\n");
out.write(" <option>修改</option>\r\n");
out.write(" </select>\r\n");
out.write(" </label>\r\n");
out.write(" </p>\r\n");
out.write(" <p>\r\n");
out.write(" <label>\r\n");
out.write(" <input type=\"submit\" name=\"Submit3\" value=\"提交\" />\r\n");
out.write(" </label>\r\n");
out.write(" </p>\r\n");
out.write(" </form> <p class=\"STYLE3\"> </p></td>\r\n");
out.write("</body>\r\n");
out.write("</html>\r\n");
out.write("\r\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -