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

📄 display_0002ejsp_jsp.java

📁 电子通讯薄(MVC) :此示例基于MVC模式,包含四个界面:登入、添加数据、查询数据和显示所有数据,通过这个示例将会对Struts构架有进一步的了解
💻 JAVA
字号:
import addressbook.model.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;


public class display_0002ejsp_jsp extends HttpJspBase {

    // begin [file="/display.jsp";from=(7,0);to=(7,79)]
    // end

    static {
    }
    public display_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,
            			"error.jsp", true, 8192, true);

            application = pageContext.getServletContext();
            config = pageContext.getServletConfig();
            session = pageContext.getSession();
            out = pageContext.getOut();

            // HTML // begin [file="/taglibs.jsp";from=(0,49);to=(1,0)]
                out.write("\r\n");

            // end
            // HTML // begin [file="/taglibs.jsp";from=(1,32);to=(2,0)]
                out.write("\r\n");

            // end
            // begin [file="/check.jsp";from=(0,2);to=(6,0)]
                
                      if(!(((String)session.getAttribute("isLog")).equals("1")))
                      {
                        out.println("isLog:"+session.getAttribute("isLog"));
                        response.sendRedirect("logon.jsp");
                      }
            // end
            // HTML // begin [file="/check.jsp";from=(6,2);to=(7,0)]
                out.write("\r\n");

            // end
            // HTML // begin [file="/taglibs.jsp";from=(2,30);to=(3,0)]
                out.write("\r\n");

            // end
            // HTML // begin [file="/taglibs.jsp";from=(3,58);to=(4,0)]
                out.write("\r\n");

            // end
            // HTML // begin [file="/taglibs.jsp";from=(4,58);to=(5,0)]
                out.write("\r\n");

            // end
            // HTML // begin [file="/taglibs.jsp";from=(5,60);to=(10,0)]
                out.write("\r\n\r\n\r\n<!--%@ taglib uri=\"/WEB-INF/app.tld\" prefix=\"app\" %-->\r\n<!--%@ page errorPage=\"/errorpage.jsp\" %-->\r\n");

            // end
            // HTML // begin [file="/display.jsp";from=(0,33);to=(4,0)]
                out.write("\r\n<html>\r\n<body>\r\n  <LINK href=\"address.css\" type=text/css rel=stylesheet>\r\n");

            // end
            // HTML // begin [file="/header.jsp";from=(0,0);to=(14,0)]
                out.write("<center>\r\n    <table>\r\n\t<tr>\r\n\t<td>\r\n\t<img border=\"0\" src=\"images/logo.gif\" width=\"164\" height=\"48\">\r\n\t</td>\r\n\t</tr>\r\n        <tr>\r\n          <td align=\"center\">\r\n            <a href=\"http://545639.tomore.com\">¸ü¶àÔ´ÂëÏÂÔØ</a>\r\n          </td>\r\n        </tr>\r\n   </table>\r\n</center>\r\n");

            // end
            // HTML // begin [file="/display.jsp";from=(4,32);to=(6,0)]
                out.write("\r\n<!--%@ include file=\"displayContent.jsp\" %-->\r\n");

            // end
            // HTML // begin [file="/display.jsp";from=(6,51);to=(7,0)]
                out.write("\r\n");

            // end
            // begin [file="/display.jsp";from=(7,0);to=(7,79)]
                addressbook.model.AddressBookBean bean = null;
                boolean _jspx_specialbean  = false;
                 synchronized (pageContext) {
                    bean= (addressbook.model.AddressBookBean)
                    pageContext.getAttribute("bean",PageContext.PAGE_SCOPE);
                    if ( bean == null ) {
                        _jspx_specialbean = true;
                        try {
                            bean = (addressbook.model.AddressBookBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "addressbook.model.AddressBookBean");
                        } catch (ClassNotFoundException exc) {
                             throw new InstantiationException(exc.getMessage());
                        } catch (Exception exc) {
                             throw new ServletException (" Cannot create bean of class "+"addressbook.model.AddressBookBean", exc);
                        }
                        pageContext.setAttribute("bean", bean, PageContext.PAGE_SCOPE);
                    }
                 } 
                if(_jspx_specialbean == true) {
            // end
            // begin [file="/display.jsp";from=(7,0);to=(7,79)]
                }
            // end
            // HTML // begin [file="/display.jsp";from=(7,79);to=(14,0)]
                out.write("\r\n<center>\r\n<h3>All the Addresses</h3>\r\n   <table align=\"center\" border=\"1\" cellspacing=\"2\" cellpadding=\"2\">\r\n         <tr>\r\n        <td>name</td><td>phone</td><td>address</td>\r\n      </tr>\r\n");

            // end
            // begin [file="/display.jsp";from=(14,2);to=(31,0)]
                
                   Collection temp=bean.search("select * from book order by ID");
                   Iterator it=temp.iterator();
                   while(it.hasNext())
                   {
                     AddressBook addressBook=(AddressBook)it.next();
                     out.println("<tr>");
                     try
                     {
                        out.println("<td>"+addressBook.getName()+"</td>");
                        out.println("<td>"+addressBook.getPhone()+"</td>");
                        out.println("<td>"+addressBook.getAddress()+"</td>");
                     }
                     catch(Exception e)
                     {}
                     out.println("</tr>");
                  }
            // end
            // HTML // begin [file="/display.jsp";from=(31,2);to=(38,0)]
                out.write("\r\n    </table>\r\n\r\n<a href=\"mainMenu.jsp\">mainMenu</a>\r\n&nbsp;&nbsp;\r\n<a href=\"search.jsp\">search</a>\r\n</center>\r\n");

            // end
            // HTML // begin [file="/footer.jsp";from=(0,0);to=(14,0)]
                out.write("<center>\r\n<table>\r\n\t<tr>\r\n\t<td>\r\n            <img border=\"0\" src=\"images/mysql.png\" width=\"125\" height=\"42\">\r\n\t</td>\r\n\t<td>\r\n           <img border=\"0\" src=\"images/power.gif\" width=\"95\" height=\"37\">\r\n\t<td>\r\n\t</tr>\r\n\r\n</table>\r\n</center>\r\n\r\n");

            // end
            // HTML // begin [file="/display.jsp";from=(38,32);to=(41,0)]
                out.write("\r\n</body>\r\n</html>\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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -