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

📄 jsp-applications.xtp

📁 RESIN 3.2 最新源码
💻 XTP
字号:
<document>  <header>    <product>resin</product>    <title>Applications</title>    <description>      <p>      An application collects servlets, JSP pages, scripts and Java      Beans into a self-contained web application.  Applications are      just generalized virtual hosts, only based on the URL instead of      the host name.      </p>    </description>  </header>  <body><summary/><s1 title="Introduction"><p>An application collects servlets, JSP pages, scripts and Java Beans into aself-contained web application.  Applications are just generalized virtualhosts, only based on the URL instead of the host name.</p><p>For example, abulletin board application groups pages for article reading, grouplisting, user registration, and new article posting into a singleapplication.</p><p>Applications can keep track of user sessions, giving the users theillusion of a single application out of disjoint pages.</p><ul><li>Resin organizes applications with an application <a href="#dir">directory</a>, WEB-INF</li><li><a href="#session">Sessions</a> share state for a user's visit tothe site.</li></ul><p>Many, if not most sites, will only use the default application.</p></s1><s1 name="dir" title="Applications"><deftable title="application contents"><tr><th>File/Directory</th><th>Contents</th></tr><tr><td>.</td><td>JSP, HTML and GIF files</td></tr><tr><td>WEB-INF/classes</td><td>Java class files</td></tr><tr><td>WEB-INF/lib</td><td>Java jars</td></tr><tr><td>WEB-INF/tmp</td><td>Temporary servlet files</td></tr><tr><td>WEB-INF/work</td><td>Generated java for JSP and XSLT</td></tr></deftable><ul><li><img src="folder.gif"/>&#160;example<ul>  <li><img src="file.gif"/>&#160;index.html  </li><li><img src="file.gif"/>&#160;folder.gif  </li><li><img src="file.gif"/>&#160;article.gif  </li><li><img src="jsp.gif"/>&#160;post-article.xtp  </li><li><img src="folder.gif"/>&#160;jsp-interest  <ul>    <li><img src="jsp.gif"/>&#160;index.jsp    </li><li><img src="jsp.gif"/>&#160;article1.jsp    </li><li><img src="jsp.gif"/>&#160;article2.jsp  </li></ul>  </li><li><img src="folder.gif"/>&#160;WEB-INF  <ul>    <li><img src="folder.gif"/>&#160;lib    <ul>      <li><img src="bean.gif"/>&#160;bulletin-board.jar    </li></ul>    </li><li><img src="folder.gif"/>&#160;classes    <ul>      <li><img src="bean.gif"/>&#160;Navigation.class      </li><li><img src="bean.gif"/>&#160;HelloWorld.class    </li></ul>    </li><li><img src="folder.gif"/>&#160;xsl    <ul>      <li><img src="style.gif"/>&#160;default.xsl      </li><li><img src="style.gif"/>&#160;article.xsl    </li></ul>  </li></ul></li></ul></li></ul></s1><s1 name="beans" title="JSP Beans"><p>Java Beans get first class treatment in JSP 1.0.  Beans can becreated for a page, across a session, or for the entire application.</p><p>The classes and lib directories can contain application beans used by <a href="jsp-actions.xtp#usebean">jsp:useBean</a>.  These are simply Javaclasses implementing the bitmechanic work of an application.</p><p>For example, a shopping cart application may have a set of Javaclasses that perform the security necessary for credit cardprocessing.  The application can put those classes in the beansdirectory and access them from the JSP page.</p><p>Beans can be created with different lifetimes.</p><ul><li>Application beans last the lifetime of an application.</li><li>Session beans last for a user's session.</li><li>Request beans last for a single request.</li><li>Page beans only last for a single page.</li></ul><p>Requests and pages often last the same lifetime, but may differ if onepage <a href="jsp-actions.xtp#forward">forwards</a>or <a href="jsp-actions.xtp#include">includes</a> another page. </p><s2 title="Accessing Beans"><p>Each bean is defined with a <a href="jsp-actions.xtp#usebean">jsp:useBean</a>directive.</p><p>JSP assigns the created bean object to the JavaScript variablenamed by jsp:useBean.</p><p>In addition, the created beans are stored in JSP variables: pagebeans are stored in <code>request</code>, session beans are stored in<code>session</code>, and application beans are stored in<code>application</code>.  Storing the beans in the JSP variables letsother beans and functions retrieve the beans.</p><example title="Beans in variables: test.jsp">&lt;jsp:useBean id='test' class='java.util.Hashtable'&gt;&amp;lt% test.put("a", 1); %&gt;&amp;lt%= test.get("a"); %&gt;</example><example title="Page beans in request: test.jsp">&lt;jsp:useBean id='test' class='java.util.Hashtable'&gt;&lt;%   var t = request.attributes.test  t.put("a", 1);%&gt;&amp;lt%= test.get("a"); %&gt;</example><results>1</results></s2></s1><s1 name="session" title="Sessions"><p>Session variables let applications keep track of the user as she movesthrough the site.  Any e-commerce site needs this capability to keeptrack of the user's purchases.</p><p>JSP sessions start when the page accesses the <a href="jsp-variables.xtp#session">session</a> variable.</p><p>Sessions end when the session times out, when the session isinvalidated, or when the application ends.</p></s1>    </body></document>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -