You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by mr...@apache.org on 2004/12/17 08:16:41 UTC
svn commit: r122622 - /struts/core/trunk/build-webapps.xml /struts/core/trunk/doc/bsf /struts/core/trunk/doc/bsf/index.xml /struts/core/trunk/doc/bsf/project.xml /struts/core/trunk/doc/project.xml
Author: mrdon
Date: Thu Dec 16 23:16:39 2004
New Revision: 122622
URL: http://svn.apache.org/viewcvs?view=rev&rev=122622
Log:
Adding BSF Scripting website documentation
Added:
struts/core/trunk/doc/bsf/
struts/core/trunk/doc/bsf/index.xml
struts/core/trunk/doc/bsf/project.xml
Modified:
struts/core/trunk/build-webapps.xml
struts/core/trunk/doc/project.xml
Modified: struts/core/trunk/build-webapps.xml
Url: http://svn.apache.org/viewcvs/struts/core/trunk/build-webapps.xml?view=diff&rev=122622&p1=struts/core/trunk/build-webapps.xml&r1=122621&p2=struts/core/trunk/build-webapps.xml&r2=122622
==============================================================================
--- struts/core/trunk/build-webapps.xml (original)
+++ struts/core/trunk/build-webapps.xml Thu Dec 16 23:16:39 2004
@@ -242,6 +242,16 @@
excludes="project.xml"
reloadstylesheet="true">
<param name="project-path" expression="../userGuide/project.xml"/>
+ </style>
+
+ <!-- Create the bsf scripting subproject site -->
+ <style basedir="${doc.dir}/bsf"
+ destdir="${build.home}/documentation/bsf"
+ extension=".html" style="${doc.dir}/stylesheets/struts.xsl"
+ includes="*.xml"
+ excludes="project.xml"
+ reloadstylesheet="true">
+ <param name="project-path" expression="../bsf/project.xml"/>
</style>
<!-- Copy the basic documentation files -->
Added: struts/core/trunk/doc/bsf/index.xml
Url: http://svn.apache.org/viewcvs/struts/core/trunk/doc/bsf/index.xml?view=auto&rev=122622
==============================================================================
--- (empty file)
+++ struts/core/trunk/doc/bsf/index.xml Thu Dec 16 23:16:39 2004
@@ -0,0 +1,126 @@
+<?xml version="1.0"?>
+<document url="index.html">
+
+ <properties>
+ <author>Don Brown</author>
+ <title>BSF Scripting</title>
+ </properties>
+
+ <body>
+
+ <section name="Struts BSF Scripting" href="overview">
+ <p>This project allows Struts Actions to be written in the scripting
+ language of one's choice rather than as Java classes. It uses the
+ <a href="http://jakarta.apache.org/bsf">Beans Scripting Framework</a>
+ to allow scripts to be written in any language BSF supports like Perl,
+ Python, Ruby, JavaScript, BeanShell, and even VBScript.
+ </p>
+ </section>
+ <section name="Features" href="features">
+ <ul>
+ <li>Implement Actions with JavaScript, BeanShell, etc.</li>
+ <li>Supports all BSF languages</li>
+ <li>Scripts cached in memory on first use</li>
+ <li>Ability to pass parameters to script through Struts config</li>
+ </ul>
+ </section>
+ <section name="What's New" href="new">
+ <section name="0.4 - April 26, 2004">
+ <ul>
+ <li>Updated Beanshell to 1.3</li>
+ <li>Updated Jakarta BSF to 2.3.0</li>
+ <li>Changed default engine mappings so if no properties file is specified, uses default BSF mappings</li>
+ <li>Fixed example bugs</li>
+ <li>Fixed StrutsInfo to correctly return action forward object if specified</li>
+ <li>Fixed bug in RequestToVariableFilter to correct check for pre-existing scripting variable using the same name as a request parameter.</li>
+ </ul>
+ </section>
+ <section name="0.3 - June 6, 2003">
+ <ul>
+ <li>Reorganized how Struts objects are presented</li>
+ <li>Added a configurable filter system to easily manipulate the context</li>
+ <li>Added a filter that adds request parameters as variables</li>
+ <li>Added ability to pass parameters to scripts in the action definition</li>
+ <li>Added and updated Javadocs, code cleanups, documentation</li>
+ </ul>
+ </section>
+ <section name="0.2 - Unreleased">
+ <ul>
+ <li>Added the ability to configure other BSF engines</li>
+ </ul>
+ </section>
+ <section name="0.1 - Unreleased">
+ <ul>
+ <li>Working Action implementation with hardcoded BeanShell support</li>
+ <li>Rewrote struts-example to demonstrate usage</li>
+ </ul>
+ </section>
+ </section>
+ <section name="Usage Notes" href="usage">
+ <p>To determine what script will be executed, the "parameter" attribute of
+ the action mapping should contain the name of the script relative to
+ the web application root directory (i.e. http://server/app). In the place of
+ the traditional Action implementation, use the value <code>org.twdata.struts.ScriptAction</code>.
+ For example:
+ </p>
+<pre>
+ <action path="/logoff"
+ type="org.twdata.struts.ScriptAction"
+ parameter="/WEB-INF/scripts/Logoff.bsh">
+ <forward name="success" path="/index.jsp"/>
+ </action>
+</pre>
+ <p>In addition to specifying the script file, the "parameter" attribute can
+ also contain parameters that will be passed to the script in the form of
+ pre-defined variables. The format follows the URL format:</p>
+<pre>
+ parameter="/path/file.bsh?PARAMETER_NAME=PARAMETER_VALUE[&amp;PARAMETER_NAME=PARAMETER_VALUE..]"
+</pre>
+ <p>One example of how passed parameters can be used is have one script file
+ handle multiple actions.</p>
+ <p>
+ Before the script completes, the next ActionForward needs to be
+ specified. This can be done one of two ways:
+ </p>
+ <ol>
+ <li>Set <code>struts.forwardName</code> to the name of the forward</li>
+ <li>Set <code>struts.forward</code> to the actual ActionForward object
+ </li>
+ </ol>
+ <p>A number of pre-defined variables are available to the script:</p>
+ <ul>
+ <li><code>request</code> - The HTTP request</li>
+ <li><code>response</code> - The HTTP response</li>
+ <li><code>session</code> - The session</li>
+ <li><code>application</code> - The servlet context</li>
+ <li><code>struts</code> - A grouping of all Struts-related objects</li>
+ <li><code>log</code> - A logging instance</li>
+ </ul>
+ <p>
+ You can add your own variables by creating a BSFManagerFilter and
+ configuring it in struts-bsf.properties:
+ </p>
+ <ul>
+ <li><code>struts-bsf.filters.FILTER_NAME.class=FILTER_CLASS</code> - The
+ class implementing BSFManagerFilter where FILTER_NAME is the name you
+ are calling the filter.</li>
+ <li><code>struts-bsf.filters.FILTER_NAME.PROPERTY_NAME=PROPERTY_VALUE</code>
+ - A property to be used by the filter.</li>
+ </ul>
+ <p>
+ To use other scripting engines other than BeanShell, create a file called
+ <code>struts-bsf.properties</code> and add two properties for each engine:
+ </p>
+ <ul>
+ <li><code>struts-bsf.engine.ENGINE_NAME.class</code> - The class of the BSF
+ engine where ENGINE_NAME is the name you are calling the engine.</li>
+ <li><code>struts-bsf.engine.ENGINE_NAME.extensions</code> - A comma-delimited
+ list of file extensions that will be used to identify the engine to use
+ to execute the script.</li>
+ </ul>
+ </section>
+
+
+ </body>
+
+</document>
Added: struts/core/trunk/doc/bsf/project.xml
Url: http://svn.apache.org/viewcvs/struts/core/trunk/doc/bsf/project.xml?view=auto&rev=122622
==============================================================================
--- (empty file)
+++ struts/core/trunk/doc/bsf/project.xml Thu Dec 16 23:16:39 2004
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project name="Struts Framework"
+ href="http://struts.apache.org/bsf"
+ image="images/struts.gif">
+
+ <title>Struts BSF Scripting - Apache Struts Framework</title>
+
+ <menu name="BSF Scripting">
+ <item name="Welcome" href="index.html"/>
+ <item name="What's New" href="index.html#new"/>
+ <item name="Usage" href="index.html#usage"/>
+ <item name="Download (Sourceforge)" href="http://sourceforge.net/project/showfiles.php?group_id=49385&package_id=84734"/>
+ </menu>
+
+ <menu name="Quick Links">
+ <item
+ name="Struts"
+ href="../index.html"/>
+ <item
+ name="User and Developer Guides *"
+ href="../userGuide/index.html"/>
+ <item
+ name="FAQs and HowTos"
+ href="../faqs/index.html"/>
+ </menu>
+
+
+</project>
+
+
+
+
+
+
Modified: struts/core/trunk/doc/project.xml
Url: http://svn.apache.org/viewcvs/struts/core/trunk/doc/project.xml?view=diff&rev=122622&p1=struts/core/trunk/doc/project.xml&r1=122621&p2=struts/core/trunk/doc/project.xml&r2=122622
==============================================================================
--- struts/core/trunk/doc/project.xml (original)
+++ struts/core/trunk/doc/project.xml Thu Dec 16 23:16:39 2004
@@ -34,7 +34,14 @@
href="announce.html"
/>
</menu>
-
+
+ <menu name="Subprojects">
+ <item
+ name="BSF Scripting"
+ href="bsf/index.html"
+ />
+ </menu>
+
<menu name="Documentation">
<item
name="User and Developer Guides"
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org