?? jsp2_jsp.java
字號(hào):
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
public final class jsp2_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
String file;
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=gb2312");
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('\r');
out.write('\n');
request.setCharacterEncoding("gb2312");
out.write("\r\n");
out.write("<SCRIPT LANGUAGE=\"JavaScript\">\r\n");
out.write("m = new Array()\r\n");
out.write("m[0] = \"今日新到教材\"\r\n");
out.write("m[1] = \"教材購(gòu)銷(xiāo)管理網(wǎng)站通知1\"\r\n");
out.write("m[2] = \"今日新到教材\"\r\n");
out.write("m[3] = \"教材購(gòu)銷(xiāo)管理網(wǎng)站通知2\"\r\n");
out.write("m[4] = \"今日新到教材\"\r\n");
out.write("m[5] = \"教材購(gòu)銷(xiāo)管理網(wǎng)站通知3\"\r\n");
out.write("m[6] = \"今日新到教材\"\r\n");
out.write("m[7] = \"教材購(gòu)銷(xiāo)管理網(wǎng)站通知4\"\r\n");
out.write("//修改變換顏色\r\n");
out.write("bagcolor = new Array()\r\n");
out.write("bagcolor[0] = \"#CCCCCC\"\r\n");
out.write("bagcolor[1] = \"#FFFF66\"\r\n");
out.write("bagcolor[2] = \"#CCFFFF\"\r\n");
out.write("bagcolor[3] = \"#AAEEFF\"\r\n");
out.write("bagcolor[4] = \"#CCFF88\"\r\n");
out.write("bagcolor[5] = \"#FF9933\"\r\n");
out.write("bagcolor[6] = \"#99AAFF\"\r\n");
out.write("bagcolor[7] = \"#6699FF\"\r\n");
out.write("var i=0;\r\n");
out.write("\r\n");
out.write("function Ran(R) {\r\n");
out.write("\treturn Math.floor((R+1)*Math.random())\r\n");
out.write("}\r\n");
out.write("\r\n");
out.write("function play_rt()\r\n");
out.write("{\r\n");
out.write("\trt1.style.filter=\"revealTrans(Duration=1.5,Transition=\" + Ran(22) + \")\";\r\n");
out.write(" rt1.filters.revealTrans.apply();\r\n");
out.write("\trt1.style.background=bagcolor[Ran(7)];\r\n");
out.write("\trt1.innerHTML=m[Ran(6)];\r\n");
out.write(" rt1.filters.revealTrans.play();\r\n");
out.write(" timer = setTimeout(\"play_rt()\",3000)\r\n");
out.write("}\r\n");
out.write("</SCRIPT>\r\n");
String Username=request.getParameter("name");
String Password=request.getParameter("Password");
String input= request.getParameter("rand");
if (Username!=null && Password!=null)
{
//把用戶(hù)名和密碼保存在session中
session.setAttribute("user_name",Username);
session.setAttribute("pass_word",Password);
session.setAttribute("input",input);
//驗(yàn)證用戶(hù)輸入的驗(yàn)證碼是否正確
if(input.equals(session.getAttribute("random")))
{
//如果正確就跳轉(zhuǎn)到check.jsp驗(yàn)證用戶(hù)名密碼
response.sendRedirect("check.jsp");
}
else
{
//驗(yàn)證碼不正確
out.print("驗(yàn)證碼錯(cuò)誤");
}
}
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("<script type=\"text/javascript\">\r\n");
out.write("function check()\r\n");
out.write("{\r\n");
out.write(" if (form.name.value==\"\")\r\n");
out.write(" {\r\n");
out.write(" alert(\"請(qǐng)輸入用戶(hù)名!!!\");\r\n");
out.write(" form.name.focus();\r\n");
out.write(" return false;\r\n");
out.write(" }\r\n");
out.write(" if (form.Password.value==\"\")\r\n");
out.write(" {\r\n");
out.write(" alert(\"請(qǐng)輸入密碼!!!\");\r\n");
out.write(" form.name.focus();\r\n");
out.write(" return false;\r\n");
out.write(" }\r\n");
out.write("}\r\n");
out.write("</SCRIPT>\r\n");
out.write("\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<title>教材購(gòu)銷(xiāo)管理網(wǎng)頁(yè)</title>\r\n");
out.write("\r\n");
out.write("<link href=\"css4.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
out.write("<script type=\"text/javascript\" language=\"javascript\" src=\"script.js\"></script>\r\n");
out.write("</head>\r\n");
out.write("<center>\r\n");
out.write("<body onload=\"play_rt();menuSlider.init('menu','slide')\">\r\n");
out.write("<!--css布局container容器-->\r\n");
out.write("<div id=\"container\">\r\n");
out.write("<!--css布局Sidebar1欄-->\r\n");
out.write("<div id=Sidebar1>\r\n");
out.write("<center>\r\n");
out.write("<table width=100% height=600 border=2 cellpadding=2 cellspacing=8 style=\"border-collapse:collapse;\" bordercolor=\"threeddarkshadow\" >\r\n");
out.write("<TBODY>\r\n");
out.write("<TR>\r\n");
out.write("<TD>\r\n");
out.write("<marquee direction=\"left\" scrollamount=\"2\" scrolldelay=\"1\" width=\"100\" height=\"100\"> <font color=\"red\"> 沒(méi)書(shū)了!別購(gòu)了!</font></marquee>\r\n");
out.write("</TD>\r\n");
out.write("<TR>\r\n");
out.write("<TD><a href=\"jsp1.jsp\">申請(qǐng)教材1</a></TD></TR>\r\n");
out.write("<TR>\r\n");
out.write("<TD><a href=\"jsp1.jsp\">申請(qǐng)教材2</a></TD></TR>\r\n");
out.write("<TR><TD><a href=\"jsp1.jsp\">申請(qǐng)教材3</a></TD></TR>\r\n");
out.write("<TR><TD><a href=\"jsp1.jsp\">申請(qǐng)教材4</a></TD></TR>\r\n");
out.write("<TR><TD><font color=\"red\" >本站連接</font></TD></TR>\r\n");
out.write("<TR><TD><a href=\"www.baidu.com\">百度</a></TD></TR>\r\n");
out.write("</TBODY></TABLE>\r\n");
out.write("<br>\r\n");
out.write("\r\n");
out.write("</center>\r\n");
out.write("</div>\r\n");
out.write(" <div id=\"Header\"></div>\r\n");
out.write("<!-- dasasdasd-->\r\n");
out.write(" <div id=\"slide\"><div class=\"menu\">\r\n");
out.write(" <ul id=\"menu\">\r\n");
out.write(" <li><a href=\"jsp1.jsp\">申請(qǐng)教材</a></li>\r\n");
out.write(" <li><a href=\"2.jsp\">查看借閱歷史</a></li>\r\n");
out.write(" <li><a href=\"jsp3.jsp\">查看教材庫(kù)</a></li>\r\n");
out.write(" <li value=\"1\"><a href=\"#\">相冊(cè)</a></li>\r\n");
out.write(" <li><a href=\"#\">論壇</a></li>\r\n");
out.write(" <li><a href=\"#\">離開(kāi)</a></li>\r\n");
out.write(" </ul> \r\n");
out.write(" <div id=\"banner\">\r\n");
out.write("\r\n");
out.write(" </div>\r\n");
out.write("<FORM Action=\"ss.jsp\" method=\"POST\" name=\"myform\">\r\n");
out.write("搜索 :<input type=\"text\" name=\"sousuo\" style=\"height:18px;width:120px\">\r\n");
out.write("<input type=\"submit\" name=\"sousuo\" value=\"搜 索\" >\r\n");
out.write("</FORM></div></div>\r\n");
out.write("<!-- dasasdasd-->\r\n");
out.write(" <div id=\"PageBody\">\r\n");
out.write("<form name=\"form\" onsubmit=\"return check()\" action=\"jsp2.jsp\" method=\"post\">\r\n");
out.write("\r\n");
out.write("用戶(hù)\r\n");
out.write("<input type=\"text\" name=\"name\" style=\"height:18px;width:100px\">\r\n");
out.write("密碼\r\n");
out.write("<input type=\"password\" name=\"Password\" style=\"height:18px;width:100px\">\r\n");
out.write(" \r\n");
out.write("認(rèn)證碼:\r\n");
out.write(" <input type=text name=rand maxlength=4 value=\"\" size=6>\r\n");
out.write(" \r\n");
out.write(" <img border=1 src=\"image.jsp\">\r\n");
out.write("<input type=\"submit\" name=\"submit\" value=\" 登陸\"><A href=\"zc1.jsp\">注冊(cè)新用戶(hù)</A><br>\r\n");
out.write("</form>\r\n");
out.write(" <div id=\"Sidebar\">\r\n");
out.write("新聞發(fā)布區(qū)\r\n");
out.write("<table height=100 border=2 cellpadding=2 cellspacing=8 >\r\n");
out.write("<TBODY>\r\n");
out.write("<TR>\r\n");
out.write("<TD>\r\n");
out.write("<marquee direction=\"left\" scrollamount=\"2\" scrolldelay=\"1\" width=\"100\" height=\"100\"> <font color=\"red\"> 沒(méi)書(shū)了!別購(gòu)了!</font></marquee>\r\n");
out.write("</TD></TR></TBODY></TABLE>\r\n");
out.write("<TABLE WIDTH=\"160\" BORDER=\"1\" HEIGHT=\"82\">\r\n");
out.write("<TR >\r\n");
out.write("<TD id=\"rt1\" HEIGHT=\"82\"></TD>\r\n");
out.write("</TR>\r\n");
out.write("</TABLE>\r\n");
out.write("<div id=\"templayer\" style=\"position:absolute;left:0;top:0;visibility:hidden\"></div>\r\n");
out.write(" </div>\r\n");
out.write(" <div id=\"MainBody\">\r\n");
out.write("教材更新發(fā)布區(qū)<BR>\r\n");
out.write("<TABLE WIDTH=\"500\" BORDER=\"0\" HEIGHT=\"120\">\r\n");
out.write("<TR >\r\n");
out.write(" <td align=center><font color=\"#309aff\">教材名</font></td>\r\n");
out.write(" <td align=center><font color=\"#309aff\">單價(jià)</font></td>\r\n");
out.write(" <td align=center><font color=\"#309aff\">出版社</font></td>\r\n");
out.write("<td align=center><font color=\"#309aff\">教材圖片</font></td></tr>\r\n");
String sql = "select * from s where xianshi='1'";
Statement stmt=null;
PreparedStatement pstmt=null;
ResultSet rs=null;
//加載JDBC-ODBC橋驅(qū)動(dòng)
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//定義JDBC URL
}catch (Exception e) {
out.println(e.getMessage());
}
try{
String url = "jdbc:odbc:s";
//得到與數(shù)據(jù)庫(kù)的連接
Connection con = DriverManager.getConnection(url);
//顯示UPL和連接信息
System.out.print("URL:" + url);
System.out.print("Connection:" + con);
//得到一個(gè)Statement對(duì)象
stmt = con.createStatement();
//執(zhí)行SQL語(yǔ)句
System.out.print("SQL:" + sql);
rs = stmt.executeQuery(sql);
while(rs.next())
{
file=rs.getString("filename");
out.print("<tr><td align=center><marquee direction='left' scrollamount='2' scrolldelay='1' width='100' height='20'> "+rs.getString("bname")+"</marquee></td>");
out.print("<td align=center> <marquee direction='left' scrollamount='2' scrolldelay='1' width='100' height='20'> "+rs.getString("bjiage")+"元/本</marquee></td>");
out.print("<td align=center> <marquee direction='left' scrollamount='2' scrolldelay='1' width='100' height='20'>"+rs.getString("cbs")+"</marquee></td>");
out.print("<td align='center'><img src='"+file+"' </td></tr>");
}
}catch (Exception e) {}
out.write("\r\n");
out.write("\r\n");
out.write("</TABLE>\r\n");
out.write("<marquee direction=\"left\" scrollamount=\"2\" scrolldelay=\"1\" width=\"150\" height=\"80\"> <img border=1 src=\"2.gif\"><img border=1 src=\"5.jpg\"><img border=1 src=\"6.jpg\">\r\n");
out.write("</marquee>\r\n");
out.write(" </div>\r\n");
out.write(" </div>\r\n");
out.write(" <div id=\"Footer\">\r\n");
out.write("鏈接\r\n");
out.write(" </div>\r\n");
out.write("</div>\r\n");
out.write("<A href=\"jsp1.jsp?getname;\">申請(qǐng)教材</A>\r\n");
out.write("‖\r\n");
out.write("<A href=\"jsp2.jsp\">查看借閱歷史</A>\r\n");
out.write("‖\r\n");
out.write("<A href=\"jsp3.jsp\">查看學(xué)生記錄</A>\r\n");
out.write("‖\r\n");
out.write("<A href=\"jsp4.jsp\">離開(kāi)教材購(gòu)銷(xiāo)管理系統(tǒng)</A>\r\n");
out.write("‖\r\n");
out.write("<A href=\"jsp1.jsp\"onclick=window.close();>離開(kāi)</A>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("</body>\r\n");
out.write("</html>\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);
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -