poll_0005fresult_0002ejsp_jsp.java
来自「网上购物系统 用JSP做的 好几十页 用jbuilder运行」· Java 代码 · 共 251 行
JAVA
251 行
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
public class poll_0005fresult_0002ejsp_jsp extends HttpJspBase {
// begin [file="/poll_result.jsp";from=(1,0);to=(1,60)]
// end
// begin [file="/poll_result.jsp";from=(2,0);to=(2,58)]
// end
static {
}
public poll_0005fresult_0002ejsp_jsp( ) {
}
private static boolean _jspx_inited = false;
public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
}
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;
String _value = null;
try {
if (_jspx_inited == false) {
synchronized (this) {
if (_jspx_inited == false) {
_jspx_init();
_jspx_inited = true;
}
}
}
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=gb2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
"", true, 8192, true);
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
// HTML // begin [file="/poll_result.jsp";from=(0,100);to=(1,0)]
out.write("\r\n");
// end
// begin [file="/poll_result.jsp";from=(1,0);to=(1,60)]
beans.connDB connDB = null;
boolean _jspx_specialconnDB = false;
synchronized (pageContext) {
connDB= (beans.connDB)
pageContext.getAttribute("connDB",PageContext.PAGE_SCOPE);
if ( connDB == null ) {
_jspx_specialconnDB = true;
try {
connDB = (beans.connDB) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "beans.connDB");
} catch (ClassNotFoundException exc) {
throw new InstantiationException(exc.getMessage());
} catch (Exception exc) {
throw new ServletException (" Cannot create bean of class "+"beans.connDB", exc);
}
pageContext.setAttribute("connDB", connDB, PageContext.PAGE_SCOPE);
}
}
if(_jspx_specialconnDB == true) {
// end
// begin [file="/poll_result.jsp";from=(1,0);to=(1,60)]
}
// end
// HTML // begin [file="/poll_result.jsp";from=(1,60);to=(2,0)]
out.write("\r\n");
// end
// begin [file="/poll_result.jsp";from=(2,0);to=(2,58)]
beans.chStr chStr = null;
boolean _jspx_specialchStr = false;
synchronized (pageContext) {
chStr= (beans.chStr)
pageContext.getAttribute("chStr",PageContext.PAGE_SCOPE);
if ( chStr == null ) {
_jspx_specialchStr = true;
try {
chStr = (beans.chStr) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "beans.chStr");
} catch (ClassNotFoundException exc) {
throw new InstantiationException(exc.getMessage());
} catch (Exception exc) {
throw new ServletException (" Cannot create bean of class "+"beans.chStr", exc);
}
pageContext.setAttribute("chStr", chStr, PageContext.PAGE_SCOPE);
}
}
if(_jspx_specialchStr == true) {
// end
// begin [file="/poll_result.jsp";from=(2,0);to=(2,58)]
}
// end
// HTML // begin [file="/poll_result.jsp";from=(2,58);to=(3,0)]
out.write("\r\n");
// end
// begin [file="/poll_result.jsp";from=(3,2);to=(13,0)]
int sum=0;
ResultSet rs_sum=connDB.executeQuery("select sum(poll) as sumpoll from tb_poll");
if (rs_sum.next()){
sum=rs_sum.getInt("sumpoll");
}
ResultSet rs=connDB.executeQuery("select * from tb_poll");
String optionname="";
int poll=0;
float percent=0;
// end
// HTML // begin [file="/poll_result.jsp";from=(13,2);to=(27,1)]
out.write("\r\n<html>\r\n<head>\r\n<title>订单查询</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n<link href=\"CSS/style.css\" rel=\"stylesheet\">\r\n</head>\r\n<body>\r\n<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" background=\"Images/bg.gif\">\r\n <tr>\r\n <td>\r\n<table width=\"777\" height=\"768\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#FFFFFF\">\r\n <tr>\r\n <td valign=\"top\">\r\n\t");
// end
// begin [file="/poll_result.jsp";from=(27,1);to=(27,30)]
{
String _jspx_qStr = "";
JspRuntimeLibrary.include(request, response, "Top.jsp" + _jspx_qStr, out, false);
if ("true".equals(request.getAttribute("javax.servlet.forward.seen")))
return;
}
// end
// HTML // begin [file="/poll_result.jsp";from=(27,30);to=(31,3)]
out.write("\r\n\t<table width=\"100%\" height=\"330\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n <tr>\r\n <td width=\"26%\" valign=\"top\">\r\n\t\t ");
// end
// begin [file="/poll_result.jsp";from=(31,3);to=(31,33)]
{
String _jspx_qStr = "";
JspRuntimeLibrary.include(request, response, "left.jsp" + _jspx_qStr, out, false);
if ("true".equals(request.getAttribute("javax.servlet.forward.seen")))
return;
}
// end
// HTML // begin [file="/poll_result.jsp";from=(31,33);to=(51,5)]
out.write(" \r\n\t\t</td>\r\n <td width=\"5\" valign=\"top\" background=\"Images/Cen_separate.gif\"></td>\r\n <td width=\"73%\" valign=\"top\"><table width=\"100%\" height=\"272\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n <tr>\r\n <td width=\"97%\" height=\"220\" valign=\"top\">\r\n\t\t\t <table width=\"100%\" height=\"126\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n\r\n\t\t\t <tr>\r\n <td valign=\"top\"><table width=\"100%\" height=\"87\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n <tr>\r\n <td width=\"86%\" height=\"87\" class=\"tableBorder_B\"><img src=\"Images/index_18.gif\" width=\"185\" height=\"50\"></td>\r\n </tr>\r\n </table> </td>\r\n\t\t\t </tr>\r\n\t\t\t <tr>\r\n\t\t\t <td valign=\"top\">\r\n\t\t\t\t <br>\r\n\t\t\t\t <table width=\"90%\" height=\"150\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"tableBorder_L\">\r\n <tr>\r\n\t\t\t\t ");
// end
// begin [file="/poll_result.jsp";from=(51,7);to=(58,6)]
rs.last();
int rowsize=rs.getRow();
rs.first();
do{
optionname=rs.getString("optionName");
poll=rs.getInt("poll");
percent=(float)poll/sum*100; //此处必需进行强制类型转换
// end
// HTML // begin [file="/poll_result.jsp";from=(58,8);to=(61,98)]
out.write("\r\n <td height=\"127\" valign=\"bottom\" class=\"tableBorder_B\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n <tr>\r\n <td align=\"center\"><img src=\"Images/bg_Navigate.GIF\" width=\"21\" height=\"");
// end
// begin [file="/poll_result.jsp";from=(61,101);to=(61,108)]
out.print(percent);
// end
// HTML // begin [file="/poll_result.jsp";from=(61,110);to=(64,57)]
out.write("\"></td>\r\n </tr>\r\n <tr>\r\n <td height=\"24\" align=\"center\">");
// end
// begin [file="/poll_result.jsp";from=(64,60);to=(64,70)]
out.print(optionname);
// end
// HTML // begin [file="/poll_result.jsp";from=(64,72);to=(67,5)]
out.write("</td>\r\n </tr>\r\n </table></td>\r\n\t\t\t\t ");
// end
// begin [file="/poll_result.jsp";from=(67,7);to=(67,25)]
}while(rs.next());
// end
// HTML // begin [file="/poll_result.jsp";from=(67,27);to=(74,18)]
out.write("\r\n </tr>\r\n </table></td>\r\n\t\t\t </tr>\r\n </table>\r\n\t\t\t\t\t <br>\r\n\t\t\t\t\t <table width=\"90%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"tableBorder\">\r\n ");
// end
// begin [file="/poll_result.jsp";from=(74,20);to=(79,7)]
rs.first();
do{
optionname=rs.getString("optionName");
poll=rs.getInt("poll");
percent=(float)poll/sum*100; //此处必需进行强制类型转换
// end
// HTML // begin [file="/poll_result.jsp";from=(79,9);to=(81,96)]
out.write("\r\n\t\t\t\t\t <tr>\r\n <td width=\"35%\" height=\"27\" align=\"left\" class=\"tableBorder_B1\"> ");
// end
// begin [file="/poll_result.jsp";from=(81,99);to=(81,125)]
out.print(rs.getString("optionName"));
// end
// HTML // begin [file="/poll_result.jsp";from=(81,127);to=(82,83)]
out.write("</td>\r\n <td width=\"39%\" align=\"center\" class=\"tableBorder_B1\">共有[");
// end
// begin [file="/poll_result.jsp";from=(82,86);to=(82,103)]
out.print(rs.getInt("poll"));
// end
// HTML // begin [file="/poll_result.jsp";from=(82,105);to=(83,82)]
out.write("]人投票</td>\r\n <td width=\"26%\" align=\"center\" class=\"tableBorder_B1\">占 ");
// end
// begin [file="/poll_result.jsp";from=(83,85);to=(83,92)]
out.print(percent);
// end
// HTML // begin [file="/poll_result.jsp";from=(83,94);to=(85,6)]
out.write("%</td>\r\n\t\t\t\t\t </tr>\r\n\t\t\t\t\t\t");
// end
// begin [file="/poll_result.jsp";from=(85,8);to=(85,27)]
} while(rs.next());
// end
// HTML // begin [file="/poll_result.jsp";from=(85,29);to=(92,6)]
out.write("\r\n </table></td>\r\n <td width=\"3%\" valign=\"top\"> </td>\r\n </tr>\r\n </table></td>\r\n </tr>\r\n </table>\r\n ");
// end
// begin [file="/poll_result.jsp";from=(92,6);to=(92,41)]
{
String _jspx_qStr = "";
JspRuntimeLibrary.include(request, response, "copyright.jsp" + _jspx_qStr, out, false);
if ("true".equals(request.getAttribute("javax.servlet.forward.seen")))
return;
}
// end
// HTML // begin [file="/poll_result.jsp";from=(92,41);to=(103,0)]
out.write("\r\n </td>\r\n </tr>\r\n</table>\r\n</td>\r\n </tr>\r\n</table>\r\n\r\n</body>\r\n</html>\r\n\r\n");
// end
} catch (Throwable t) {
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t);
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?