1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
<?xml version="1.0"?>
<!-- Author: Stefano Mazzocchi "stefano@apache.org" -->
<!-- Version: $Id: lib-page.xml,v 1.1.2.3 2001/04/16 17:59:44 dims Exp $ -->
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="page-html.xsl" type="text/xsl"?>
<xsp:page
language="java"
xmlns:xsp="http://www.apache.org/1999/XSP/Core"
xmlns:request="http://www.apache.org/1999/XSP/Request"
xmlns:util="http://www.apache.org/1999/XSP/Util"
>
<page>
<title>First XSP Page</title>
<author>
<name>Stefano Mazzocchi</name>
<address>stefano@apache.org</address>
</author>
<p>Hi, I'm your first XSP page ever.</p>
<p>I've been requested <util:counter/> times.</p>
<p>The content you are seeing in this page is provided to you
by an XML content producer that was compiled into Java bytecode
and executed at request time. This allows greater flexibility and
ease of use for page programmers without any performance degradation
since all XML parsing and such is precompiled and it's avoided at
request time.</p>
<p>Let's show some useful information with expression evaluation...</p>
<list title="Request Data">
<element name="Request method"><request:get-method/></element>
<element name="Request URI"><request:get-request-uri/></element>
<element name="Request protocol"><request:get-protocol/></element>
<element name="Servlet path"><request:get-servlet-path/></element>
<element name="Path info"><request:get-path-info/></element>
<element name="Path translated"><request:get-path-translated/></element>
<element name="Query string"><request:get-query-string/></element>
<element name="Content length"><request:get-content-length/></element>
<element name="Content type"><request:get-content-type/></element>
<element name="Server name"><request:get-server-name/></element>
<element name="Server port"><request:get-server-port/></element>
<element name="Remote user"><request:get-remote-user/></element>
<element name="Remote address"><request:get-remote-addr/></element>
<element name="Remote host"><request:get-remote-host/></element>
<element name="Authorization scheme"><request:get-auth-type/></element>
</list>
<p>Ok. Now that you know how logic can be transformed into content, let's
add some juice and mix logic with content generation
in a way that allows you to forget about what method is used to generate and
handle the content as XML and concentrate on having your work done.
Note, how XSP don't allow you to explicitly write something on the response
from the logic realm: this is one of the major
differences between XSP and other server pages technologies and allows
further processing of the produced content, as required, for example, by
XSL-transformations.</p>
<!-- FIXME (SM): here should go some taglib to emulate the other two
examples, but we don't have yet a good way to iterate over items
and so on without using logic directly... more feedback is needed on
the taglib issue. -->
<p>All right, the first XSP page is over, but you can see the dynamically syntax highlighted
<link href="../view-source.xml?filename=lib-page.xml">source of this page</link>,
all provided to you by another XSP page.</p>
<p>Enjoy XSP!</p>
</page>
</xsp:page>
|