📄 _1_jsp.java
字号:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
public final class _1_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.Vector _jspx_dependants;
public java.util.List 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=GBK");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write('\n');
request.setCharacterEncoding("gb2312");
out.write("\n");
out.write("<link href=\"2.css\" rel=\"stylesheet\" type=\"text/css\" />\n");
out.write("<script type=\"text/javascript\">\n");
out.write("function mycheck(){\n");
out.write("alert(\"更新 成功!\");\n");
out.write("}\n");
out.write("</script>\n");
out.write("<HTML><BODY>\n");
out.write("<center>\n");
out.write("\n");
out.write("<div id=\"container\">\n");
out.write("\n");
out.write("<center><font SIZE=\"30\" color=\"red\">管理员更新教材网页\n");
out.write("</font>\n");
out.write(" <div id=\"Header\"><div id=\"menu\">\n");
out.write("<ul>\n");
out.write(" <li><a href=\"jsp3.jsp\">查看可申请教材目录</a></li>\n");
out.write(" <li class=\"menuDiv\"></li>\n");
out.write(" <li><a href=\"jsp2.jsp\">返回主页</a><br></li>\n");
out.write(" <li class=\"menuDiv\"></li>\n");
out.write("</ul>\n");
out.write("</div></div> \n");
String getbjiage = request.getParameter("bjiage"); String getbnum = request.getParameter("bnum"); String getbooknum= request.getParameter("booknum"); String getbname = request.getParameter("bname"); String getcbs = request.getParameter("cbs"); String getfile = request.getParameter("filename"); String getshuoming = request.getParameter("shuoming"); String getxianshi = request.getParameter("xianshi");
out.write('\n');
Statement stmt=null; PreparedStatement pstmt=null; String sql = "insert into s(bnum,bname,bjiage,booknum,cbs,filename,shuoming,xianshi) VALUES(" +getbnum + ",'"+getbname + "'," +getbjiage +"," +getbooknum + ",'" +getcbs + "','" +getfile+ "','" +getshuoming+ "','" +getxianshi+ "')"; //加载JDBC-ODBC桥驱动 try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //定义JDBC URL }catch (Exception e) { out.println(e.getMessage()); } try{ String url = "jdbc:odbc:s"; //得到与数据库的连接 Connection con = DriverManager.getConnection(url); //显示UPL和连接信息 System.out.print("URL:" + url); System.out.print("Connection:" + con); //得到一个Statement对象 stmt = con.createStatement(); //执行SQL语句 System.out.print("SQL:" + sql); ResultSet p = stmt.executeQuery(sql); } catch (Exception e) {}
out.write("\n");
out.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">\n");
out.write("<tr>\n");
out.write("<td height=20 width=\"100%\" bgcolor=#6681D9> <font color=\"#ffffff\">添加教材</font>\n");
out.write("</td></tr>\n");
out.write("<tr><td>\n");
out.write("<FORM Action=\"1.jsp\" method=\"POST\" name=\"form1\">\n");
out.write("<table width=\"%100\" border=\"0\">\n");
out.write("<tr>\n");
out.write("<td colspan=\"3\" height=20></td></tr>\n");
out.write("<tr>\n");
out.write("<td align=\"right\" width=\"120\" valign=\"top\">说明:</td>\n");
out.write("<td width=\"20\"> </td>\n");
out.write("<td width=\"450\">\n");
out.write("<font color=\"red\">含*为必须填写(图片格式限制在200*150)</font></td></tr>\n");
out.write("<tr>\n");
out.write("<td align=\"right\" >书号</td>\n");
out.write("<td width=\"20\">*</td>\n");
out.write("<td width=\"500\">\n");
out.write("<input name=\"bnum\" value=\"\" size=\"64\">\n");
out.write("</td></tr>\n");
out.write("<tr>\n");
out.write("<td align=\"right\"> 教材名</td>\n");
out.write("<td width=\"20\">*</td>\n");
out.write("<td width=\"100\">\n");
out.write("<input name=\"bname\" value=\"\" size=\"64\">\n");
out.write("</td></tr>\n");
out.write("<tr>\n");
out.write("<td align=\"right\" >数量</td>\n");
out.write("<td width=\"20\">*</td>\n");
out.write("<td width=\"200\">\n");
out.write("<input name=\"booknum\" value=\"\" size=\"64\">\n");
out.write("</td></tr>\n");
out.write("<tr>\n");
out.write("<td align=\"right\" >教材出版社</td>\n");
out.write("<td width=\"20\">*</td>\n");
out.write("<td width=\"200\">\n");
out.write("<input name=\"cbs\" value=\"\" size=\"64\">\n");
out.write("</td></tr>\n");
out.write("<tr>\n");
out.write("<td align=\"right\" >教材价格</td>\n");
out.write("<td width=\"20\">*</td>\n");
out.write("<td width=\"200\">\n");
out.write("<input name=\"bjiage\" value=\"\" size=\"64\">\n");
out.write("</td></tr>\n");
out.write("<tr>\n");
out.write("<td align=\"right\" >教材图片</td>\n");
out.write("<td width=\"20\">*</td>\n");
out.write("<td width=\"200\">\n");
out.write("<input type=\"file\" name=\"filename\" value=\"\" size=\"64\">\n");
out.write("</td></tr>\n");
out.write("<tr>\n");
out.write("<td align=\"right\" valign=\"top\">教材简要说明</td>\n");
out.write("<td width=\"20\" valign=\"top\"> </td>\n");
out.write("<td>\n");
out.write("<textarea name=\"shuoming\"cols=\"64\" rows=\"5\">\n");
out.write("</textarea>\n");
out.write("</td></tr>\n");
out.write("<tr>\n");
out.write("<td align=\"right\" >显示主页发布</td>\n");
out.write("<td width=\"20\">*</td>\n");
out.write("<td width=\"100\">\n");
out.write("<select name=\"xianshi\">\n");
out.write("<option value=\"1\">在主页显示</option>\n");
out.write("<option value=\"2\">不在主页显示</option>\n");
out.write("</select>\n");
out.write("</td></tr>\n");
out.write("<tr>\n");
out.write("<td align=\"right\" > </td>\n");
out.write("<td width=\"20\"> </td>\n");
out.write("<td align=\"center\">\n");
out.write("<input type=\"submit\" name=\"post\" value=\"确 定\" onclick=\"mycheck()\">\n");
out.write("<input type=\"button\" name = \"a\" value = \"返回\" onclick = \"javacscript:history.back()\">\n");
out.write("</td></tr>\n");
out.write("</table>\n");
out.write("</form>\n");
out.write(" </td></tr></table>\n");
out.write("<html><body>\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 + -