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

📄 jsp-actions.xtp

📁 解压在c盘
💻 XTP
字号:
<s1 title="JSP Actions"><objsummary/><s2 name='lex' title='JSP Lexical'><defun name=jsp-escape title='escapes' index='escapes'><p>The JSP actions can be escaped using <var/&lt;\%/>.</p><example>&lt;\% verbatim text %></example><results>&lt;% verbatim text %></results></defun><defun name=whitespace title='whitespace' index='whitespace' version='Resin 1.2'><p>JSP whitespace is copied to the output directly, unless escaped.</p><p>In Resin 1.2, if you place a backslash immediately after a JSP action andbefore a line end, Resin will omit the end of line.  In the followingexample, Resin keeps the whitespace after the <var/&lt;%@page ... %>/> andremoves it after after the <var/&lt;%= 2 + 2 %>/>.</p><example>&lt;% @page session="true" %>a&lt;%= 2 + 2 %>\c</example><results>a4c</results></defun></s2><s2 name='jsp' title='JSP Actions'><defun name=directive title='&lt;%@ name att1="v1"... %&gt;'       index='directive'><p>Sets a JSP <a href='jsp-directives.xtp'>directive</a></p></defun><defun name=expr title='&lt;%= expression %&gt;'       index='expression'><p>Prints the value of <var/expression/> evaluated the page's<a href='jsp-directives.xtp#language'>language</a>.</p><p>The expression action is equivalent to the following:</p><def>  out.print(<var/expression/>);</def><p>It also has the following XML equivalent</p><def>&lt;jsp:expression>  <var/expression/>&lt;/jsp:expression></def><p>The following simple example just prints the value of a form variable.</p><example>Name: &lt;%= request.getParameter("name") %&gt;</example><results>Name: George Washington</results></defun><defun name=scriptlet title='&lt;% scriptlet %&gt;'       index='scriptlets'><p>Executes the statements in <var/scriptlet/> using the page's<a href='jsp-directives.xtp#language'>language</a>.</p><p>The <var/scriptlet/> is any statement list in the language,e.g. Java.  The scriptlet can use any of the <ahref='jsp-variables.xtp'>implicit variables</a>, such as the requestobject and the out writer.</p><p>Scriptlets have the following XML equivalent</p><def>&lt;jsp:scriptlet>  <var/scriptlet/>&lt;/jsp:scriptlet></def><example>&lt;h1&gt;Form results&lt;/h1&gt;&lt;pre&gt;&lt;%  Enumeration e = request.getParameterNames();  while (e.hasMoreElements()) {    String key = e.nextElement();    String value = request.getParameter(key);    out.println(key + ": " + value);  }%&gt;&lt;/pre&gt;</example><results>&lt;h1&gt;Form results&lt;/h1&gt;&lt;pre&gt;  Name: George Washington  Rank: General&lt;/pre&gt;</results></defun><defun name=decl title='&lt;%! declaration %&gt;'       index='declaration'><p>Adds <var/declaration/> code to the Servlet class</p><p>JSP places the declaration code in the servlet class.  In contrast,scriptlet and expression code are in a service method.  Sodeclarations can declare class variables and methods.</p><note>Declarations are primarily useful for Java, but are allowed inJavaScript.</note><p>Declarations have the following XML equivalent</p><def>&lt;jsp:declaration>  <var/declaration/>&lt;/jsp:declaration></def><example>&lt;%= foo() %&gt;&lt;%!  private int foo() { return 1329; }%&gt;</example></defun><defun name=include title='&lt;jsp:include page="path"/&gt;'       index='include, runtime'><p>Includes the contents of the local URL at <var/path/> duringruntime.</p><p>jsp:include is a runtime action.  It will call the included<var/path/> just as if <var/path/> its own HTTP request.  The resultof that page will be included in the current page.</p><p><var/path/> is relative to the current page.  Its root is the rootof the application.</p><p>For compile-time includes, use <ahref='jsp-directives.xtp#include'>&lt;%@ include file='path'%&gt;</a></p><example title='inc.jsp'>&lt;%= 2 + 2 %&gt;</example><example title='test.jsp'>Header&lt;jsp:include page='inc.jsp'/&gt;Footer</example><results>Header4Footer</results></defun><defun name=forward title='&lt;jsp:forward page="path" /&gt;'       index='forward; redirect'><p>Forwards the request to another page, i.e. an internal redirect.</p><p>If the page has already written some output, jsp:request will clearthe output <a href='jsp-directives.xtp#buffer'>buffer</a>.</p><p><var/path/> is relative to the current page.</p><example title='fwd.jsp'>&lt;%= 2 + 2 %&gt;</example><example title='test.jsp'>Header&lt;jsp:forward page='inc.jsp'/&gt;Footer</example><results>4</results></defun><defun name=usebean title='&lt;jsp:useBean id="name" ...&gt;...'       index='bean, creation'><p>Creates a new bean and variable for the page.</p><deftable><tr><th>Attribute<th>Value<th>Meaning<tr><td>id<td>&nbsp;<td>The variable name for the bean<tr><td>class<td>&nbsp;<td>The bean's Java class<tr><td>scope<td>&nbsp;<td>&nbsp;<tr><td>&nbsp;<td>page<td>Only active in the page, stored in pageContext<tr><td>&nbsp;<td>request<td>Active for the request, stored in request<tr><td>&nbsp;<td>session<td>Active for the session, stored in session<tr><td>&nbsp;<td>application<td>Active for the application, stored in application</deftable><p>jsp:useBean enables a popular style JSP page creation where JavaBeans calculate the content, and JSP formats the presentation.</p><p>jsp:useBean creates an initializes a JSP bean for the page. Thescope attribute determines the bean lifetime.  For example, a sessionbean will be created once in a session.</p><p>jsp:useBean assigns the bean to the variable <var/name/>.  It will alsostore the bean in the appropriate scope variable.  For example, anapplication bean "foo" will be stored in the application variable.</p><p>jsp:useBean can also initialize beans.  When jsp:useBean creates anew bean, it will execute the JSP in the jsp:useBean tag.</p><p>Roughly, JSP makes the following translation:</p><example>&lt;jsp:useBean id='foo'                 class='com.caucho.test.TestBean'                 scope='session'&gt;  &lt;% foo.myInitialization("test"); %gt;&lt;/jsp:useBean&gt;</example><def>com.caucho.test.TestBean foo;foo = (com.caucho.test.TestBean) session.getValue("foo");if (foo == null) {  foo = new com.caucho.test.TestBean();  session.value.foo = foo;  foo.myInitialization("test");}</def></defun><defun name=getProperty title='&lt;jsp:getProperty name="name" ... /&gt;'       index='bean, display'><p>Prints a bean property.</p><deftable><tr><th>Attribute<th>Meaning<tr><td>name<td>The variable name for the bean<tr><td>property<td>The property name to retrieve.</deftable><p>jsp:getProperty converts property names following the beanstandards.</p><p>Roughly, jsp:getProperty makes the following conversion:</p><example>&lt;jsp:getProperty name='foo' property='bar'/&gt;</example><def>out.print(foo.getBar());</def></defun><defun name=setProperty title='&lt;jsp:setProperty ... value="value"/&gt;'       index='bean, setting'><p>Sets a bean property to <var/value/>.</p><deftable><tr><th>Attribute<th>Meaning<tr><td>name<td>The variable name for the bean<tr><td>property<td>The property name to set.<tr><td>value<td>The value to set.</deftable><p>If value is a runtime attribute, the bean property gets theexpression value.  If it's a static string, the value is firstconverted to the argument type and then set.</p><example>&lt;jsp:setProperty name='foo' property='count' value='10'/&gt;</example><results>foo.setCount(10);</results><example>&lt;jsp:setProperty name='foo' property='string' value='10'/&gt;</example><results>foo.setString("10");</results><example>&lt;jsp:setProperty name='foo' property='count' value='&lt;%= 2 + 2 %>'/&gt;</example><results>foo.setCount(2 + 2);</results><example>&lt;jsp:setProperty name='foo' property='count' value='2 + 2'/&gt;</example><results>error</results><example>&lt;jsp:setProperty name='foo' property='char' value='10'/&gt;</example><results>foo.setChar('1');</results></defun><defun name=setProperty title='&lt;jsp:setProperty ... param="param"/&gt;'       index='bean, setting'><p>Sets a bean property to a parameter value.</p><deftable><tr><th>Attribute<th>Value<th>Meaning<tr><td>name<td>&nbsp;<td>The variable name for the bean<tr><td>property<td><var/property/><td>The property name to set.<tr><td>&nbsp;<td>*<td>Set all properties<tr><td>param<td><var/param/><td>The form parameter to use as a value.<tr><td>&nbsp;<td><var/empty/><td>If missing, use <var/property/></deftable><p>The second form of jsp:setProperty lets scripts easily set Beanproperties to form values.</p></defun></s2></s1>

⌨️ 快捷键说明

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