⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 page_jsp.java

📁 j2ee程序。 spring、xml、 实现增加内容选项。
💻 JAVA
字号:
package org.apache.jsp.gc.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import java.sql.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.text.*;
import java.math.*;
import com.gd.mvc.util.GdPage;

public final class page_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

 public static final String _AppId = "page"; 
  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = JspFactory.getDefaultFactory().getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  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,
      			"", 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('\r');
      out.write('\n');

	String sql =  "select * from user";
	GdPage gdPage = new GdPage(request, sql, "30");	

      out.write("\r\n");
      out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n");
      out.write("\"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
      out.write("<html>\r\n");
      out.write("<head>\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: #FFFFFD;\r\n");
      out.write("\tfont-family: Verdana, \"宋体\";\r\n");
      out.write("\tfont-size: 12px;\r\n");
      out.write("\tfont-style: normal;\r\n");
      out.write("}\r\n");
      out.write("-->\r\n");
      out.write("</style>\r\n");
      out.write("<script language=Javascript>\r\n");
      out.write("function submit(target, action) {\r\n");
      out.write("    form1.target = target;   \r\n");
      out.write("    form1.action.value = action;\r\n");
      out.write("    form1.submit();\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("function openWin(name, url, width, height) {\r\n");
      out.write("\tvar screenWidth = screen.width;\r\n");
      out.write("\tvar screenHeight = screen.height;\r\n");
      out.write("\tvar w;\r\n");
      out.write("    \tw = window.open(url, name, \"width=\"+width+\",height=\"+height+\",menubar=no,resizable=yes,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,copyhistory=0\");\r\n");
      out.write("\tw.moveTo((screenWidth-width)/2, (screenHeight-height)/2);\r\n");
      out.write("\tw.focus();\r\n");
      out.write("}\r\n");
      out.write("function goExit() {\r\n");
      out.write("\twindow.close();\r\n");
      out.write("}\r\n");
      out.write("function check() {\r\n");
      out.write("\tsubmit('");
      out.print("login_"+session.getId());
      out.write("','page');\r\n");
      out.write("}\r\n");
      out.write("</script>\r\n");
      out.write("</head>\r\n");
      out.write("<body leftmargin=\"0\" topmargin=\"0\">\r\n");
      out.write("<form name=\"form1\" action=\"/myApp/gc/page.do\" method=\"post\">\r\n");
      out.print(gdPage.getBtnHtml());
      out.write("<br>\r\n");
      out.write("<table width=\"559\" border=\"1\" align=\"center\" cellspacing=\"0\">\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td>用户id</td>\r\n");
      out.write("    <td>用户名</td>\r\n");
      out.write("    <td>密码</td>\r\n");
      out.write("  </tr>\r\n");

Map[] maps = gdPage.getDataMaps();
HashMap obj = null;
for( int i = 0; maps != null && i < gdPage.getPageRowsCount(); i++) {
	obj = (HashMap) maps[i];

      out.write("\r\n");
      out.write("<tr>\r\n");
      out.write("    <td>");
      out.print(obj.get("id"));
      out.write("</td>\r\n");
      out.write("    <td>");
      out.print(obj.get("username"));
      out.write("</td>\r\n");
      out.write("    <td>");
      out.print(obj.get("password"));
      out.write("</td>\r\n");
      out.write("  </tr>\t\r\n");

}

      out.write("\r\n");
      out.write("</table>\r\n");
      out.write("<input type=\"hidden\" name=\"action\" value=\"\">\r\n");
      out.write("</form>\r\n");
      out.write("<script language=Javascript>\r\n");
      out.write("    window.name = \"");
      out.print("page_"+session.getId());
      out.write("\";     \r\n");
      out.write("</script>\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)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        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 + -