You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mu...@apache.org on 2007/06/10 01:55:38 UTC

svn commit: r545816 - in /struts/struts2/trunk/apps/showcase/src/main: java/org/apache/struts2/showcase/action/ resources/ webapp/WEB-INF/decorators/ webapp/interactive/

Author: musachy
Date: Sat Jun  9 16:55:37 2007
New Revision: 545816

URL: http://svn.apache.org/viewvc?view=rev&rev=545816
Log:
WW-1848 Showcase, create an interactive OGNL demo

Added:
    struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/ExampleAction.java
    struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/JSPEvalAction.java
    struts/struts2/trunk/apps/showcase/src/main/resources/struts-interactive.xml
    struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/
    struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/demo.jsp
    struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/example-action.jsp
    struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/index.jsp
    struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/jsp_0.jsp
    struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_0.jsp
    struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_1.jsp
    struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_2.jsp
    struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_3.jsp
    struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_4.jsp
Modified:
    struts/struts2/trunk/apps/showcase/src/main/resources/struts.xml
    struts/struts2/trunk/apps/showcase/src/main/webapp/WEB-INF/decorators/main.jsp

Added: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/ExampleAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/ExampleAction.java?view=auto&rev=545816
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/ExampleAction.java (added)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/ExampleAction.java Sat Jun  9 16:55:37 2007
@@ -0,0 +1,82 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.showcase.action;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+public class ExampleAction extends ActionSupport {
+
+    public String getName() {
+        return "John Galt";
+    }
+
+    public String[] getBands() {
+        return new String[] { "Pink Floyd", "Metallica", "Guns & Roses" };
+    }
+
+    public List<String> getMovies() {
+        return Arrays.asList("Lord of the Rings", "Matrix");
+    }
+
+    public Book getBook() {
+        return new Book("Iliad", "Homer");
+    }
+
+    public Map<String, Book> getBooks() {
+        Map<String, Book> books = new HashMap<String, Book>();
+        books.put("Iliad", new Book("Iliad", "Homer"));
+        books.put("The Republic", new Book("The Replublic", "Plato"));
+        books.put("Thus Spake Zarathustra", new Book("Thus Spake Zarathustra",
+            "Friedrich Nietzsche"));
+        return books;
+    }
+}
+
+class Book {
+    private String title;
+    private String author;
+
+    public Book(String title, String author) {
+        this.title = title;
+        this.author = author;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getAuthor() {
+        return author;
+    }
+
+    public void setAuthor(String author) {
+        this.author = author;
+    }
+}
\ No newline at end of file

Added: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/JSPEvalAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/JSPEvalAction.java?view=auto&rev=545816
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/JSPEvalAction.java (added)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/action/JSPEvalAction.java Sat Jun  9 16:55:37 2007
@@ -0,0 +1,77 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.showcase.action;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.struts2.ServletActionContext;
+
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.interceptor.annotations.After;
+
+/**
+ * Will only work on containers that unzip war files
+ *
+ */
+public class JSPEvalAction extends ExampleAction {
+    private String jsp;
+    private final static String FILE = "/interactive/demo.jsp";
+
+    public String execute() throws IOException {
+        if (jsp != null) {
+            //write it to file
+            URL url = ServletActionContext.getServletContext().getResource(FILE);
+            BufferedWriter writer = new BufferedWriter(new FileWriter(new File(url
+                .getFile())));
+            try {
+                //directive
+                writer.write("<%@ taglib prefix=\"s\" uri=\"/struts-tags\" %>");
+                writer.write(jsp);
+            } finally {
+                if (writer != null)
+                    writer.close();
+            }
+        }
+        return Action.SUCCESS;
+    }
+
+    @After
+    public void cleanUp() throws IOException {
+        URL url = ServletActionContext.getServletContext().getResource(FILE);
+        FileOutputStream out = new FileOutputStream(new File(url.getFile()));
+        try {
+            out.getChannel().truncate(0);
+        } finally {
+            if (out != null)
+                out.close();
+        }
+    }
+
+    public void setJsp(String jsp) {
+        this.jsp = jsp;
+    }
+
+}

Added: struts/struts2/trunk/apps/showcase/src/main/resources/struts-interactive.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/resources/struts-interactive.xml?view=auto&rev=545816
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/resources/struts-interactive.xml (added)
+++ struts/struts2/trunk/apps/showcase/src/main/resources/struts-interactive.xml Sat Jun  9 16:55:37 2007
@@ -0,0 +1,15 @@
+<!DOCTYPE struts PUBLIC
+    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+    "http://struts.apache.org/dtds/struts-2.0.dtd">
+
+<struts>
+    <package name="ognl" namespace="/nodecorate" extends="struts-default">
+        <action name="jspEval" class="org.apache.struts2.showcase.action.JSPEvalAction">
+            <interceptor-ref name="params"/>
+            <interceptor-ref name="debugging"/>
+            <interceptor-ref name="annotationWorkflow" />
+            <result>/interactive/demo.jsp</result>
+        </action>
+        <action name="example" class="org.apache.struts2.showcase.action.ExampleAction" />
+    </package>
+</struts>    
\ No newline at end of file

Modified: struts/struts2/trunk/apps/showcase/src/main/resources/struts.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/resources/struts.xml?view=diff&rev=545816&r1=545815&r2=545816
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/resources/struts.xml (original)
+++ struts/struts2/trunk/apps/showcase/src/main/resources/struts.xml Sat Jun  9 16:55:37 2007
@@ -9,7 +9,7 @@
 
     <!-- Some or all of these can be flipped to true for debugging -->
     <constant name="struts.i18n.reload" value="false" />
-    <constant name="struts.devMode" value="false" />
+    <constant name="struts.devMode" value="true" />
     <constant name="struts.configuration.xml.reload" value="false" />
     <constant name="struts.custom.i18n.resources" value="globalMessages" />
 
@@ -19,6 +19,8 @@
     <constant name="struts.serve.static.browserCache" value="false" />
 
     <include file="struts-chat.xml" />
+    
+    <include file="struts-interactive.xml" />
 
     <include file="struts-hangman.xml" />
 

Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/WEB-INF/decorators/main.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/WEB-INF/decorators/main.jsp?view=diff&rev=545816&r1=545815&r2=545816
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/WEB-INF/decorators/main.jsp (original)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/WEB-INF/decorators/main.jsp Sat Jun  9 16:55:37 2007
@@ -78,6 +78,7 @@
         <li><a href="<s:url value="/tiles/index.action" />">Tiles</a></li>
         <li><a href="<s:url value="/token/index.jsp"/>">Token</a></li>
         <li><a href="<s:url value="/validation/index.jsp"/>">Validation</a></li>
+        <li><a href="<s:url value="/interactive/index.jsp"/>">Interactive Demo</a></li>
         <li class="last"><a href="<s:url value="/help.jsp"/>">Help</a></li>
                 </ul>
             </div>

Added: struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/demo.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/demo.jsp?view=auto&rev=545816
==============================================================================
    (empty)

Added: struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/example-action.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/example-action.jsp?view=auto&rev=545816
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/example-action.jsp (added)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/example-action.jsp Sat Jun  9 16:55:37 2007
@@ -0,0 +1,69 @@
+<%
+    request.setAttribute("decorator", "none");
+    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
+    response.setHeader("Pragma","no-cache"); //HTTP 1.0
+    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
+%>
+<pre>
+package org.apache.struts2.showcase.action;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+public class ExampleAction extends ActionSupport {
+
+    public String getName() {
+        return &quot;John Galt&quot;;
+    }
+
+    public String[] getBands() {
+        return new String[] { &quot;Pink Floyd&quot;, &quot;Metallica&quot;, &quot;Guns & Roses&quot; };
+    }
+    
+    public Book getBook() {
+        return new Book(&quot;Iliad&quot;, &quot;Homer&quot;);
+    }
+
+    public List&lt;String&gt; getMovies() {
+        return Arrays.asList(&quot;Lord of the Rings&quot;, &quot;Matrix&quot;);
+    }
+
+    public Map&lt;String, Book&gt; getBooks() {
+        Map&lt;String, Book&gt; books = new HashMap&lt;String, Book&gt;();
+        books.put(&quot;Iliad&quot;, new Book(&quot;Iliad&quot;, &quot;Homer&quot;));
+        books.put(&quot;The Republic&quot;, new Book(&quot;The Replublic&quot;, &quot;Plato&quot;));
+        books.put(&quot;Thus Spake Zarathustra&quot;, new Book(&quot;Thus Spake Zarathustra&quot;, &quot;Friedrich Nietzsche&quot;));
+        return books;
+    }
+}
+
+class Book {
+    private String title;
+    private String author;
+
+    public Book(String title, String author) {
+        this.title = title;
+        this.author = author;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getAuthor() {
+        return author;
+    }
+
+    public void setAuthor(String author) {
+        this.author = author;
+    }
+}
+</pre>
\ No newline at end of file

Added: struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/index.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/index.jsp?view=auto&rev=545816
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/index.jsp (added)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/index.jsp Sat Jun  9 16:55:37 2007
@@ -0,0 +1,235 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
+
+<html>
+<head>
+    <title>OGNL and tags demo</title>
+    <s:url id="struts" value="/struts" includeParams="none"/>
+    <s:url id="jspEval" action="jspEval" namespace="/nodecorate" includeParams="none"/>
+    <s:url id="viewClass" value="/interactive/example-action.jsp" includeParams="none"/>
+    <s:url id="ognlBase" value="/interactive/ognl_" includeParams="none"/>
+    <s:url id="jspBase" value="/interactive/jsp_" includeParams="none"/>
+    
+    <script src="${struts}/webconsole.js"></script>
+    <sx:head/>
+    
+    <script>
+        var index = -1;
+        var runningOgnl = true;
+        var ognlBase = "${ognlBase}";
+        var jspBase = "${jspBase}";
+        var ognlCount = 5;
+        var jspCount = 1;
+        
+        dojo.addOnLoad(function() {
+            var classSrc = dojo.byId("classSrc");
+            dojo.io.updateNode(classSrc, "${viewClass}");
+            dojo.html.hide("previous");
+            dojo.html.hide("next");
+        });
+        
+        dojo.event.topic.subscribe("/reloadGuide", function() {
+            next();
+        });
+        
+        function startOgnl() {
+            index = -1;
+            runningOgnl = true;
+            change(1);
+            updateNavigation();
+        }
+        
+        function startJSP() {
+            selectJSPTab();
+            index = -1;
+            runningOgnl = false;
+            change(1);
+            updateNavigation();
+        }
+        
+        function execOgnl(id) {
+            var exp = dojo.string.trim(dojo.byId(id ? id : "example").innerHTML);
+            dojo.byId("wc-command").value = exp;
+            
+            keyEvent({keyCode : 13}, '${jspEval}');
+        }
+        
+        function evalJSP(id) {
+            var exp = dojo.string.trim(dojo.byId(id ? id : "example").innerHTML);
+            dojo.byId("jsp").value = unscape(exp);
+            
+            dojo.event.topic.publish("/evalJSP")
+        }
+        
+        function unscape(str) {
+            return str.replace(/&amp;/gm, "&").replace(/&lt;/gm, "<").replace(/&gt;/gm, ">").replace(/&quot;/gm, '"');
+        }
+        
+        function selectClassSrcTab() {
+            dojo.widget.byId("mainTabContainer").selectTab("classTab");
+        }
+        
+        function selectJSPTab() {
+            dojo.widget.byId("mainTabContainer").selectTab("jspTab");
+        }
+       
+        function change(delta) {
+            index+=delta;
+            
+            var url = (runningOgnl ? ognlBase : jspBase) + index + ".jsp";
+            var bind = dojo.widget.byId("guideBind");
+            bind.href = url;
+            dojo.event.topic.publish("/loadContent");
+            updateNavigation();
+        }
+        
+        function updateNavigation() {
+            if(index <= 0) {
+                dojo.html.hide("previous");
+            } else {
+                dojo.html.show("previous");
+            }
+            
+            var top = runningOgnl ? ognlCount : jspCount;
+            
+            if(index == top - 1) {
+                dojo.html.hide("next");
+            } else {
+                dojo.html.show("next");
+            }
+        }
+    </script>
+    
+    <style type="">
+        .wc-results {
+            overflow: auto; 
+            margin: 0px; 
+            padding: 5px; 
+            font-family: courier; 
+            color: white; 
+            background-color: black; 
+            height: 200px;
+        }
+        .wc-results pre {
+            display: inline;
+        }
+        .wc-command {
+            margin: 1px 0 0 0; 
+            border-style: none;
+            font-family: courier; 
+            color: white; 
+            background-color: black; 
+            width: 100%;
+            padding: 0px;
+        }
+        .shell {
+            width: 100%;
+        }
+       
+        .jsp {
+            border-style: solid;
+            width: 100%;
+            height: 300px;
+        }
+        .jspResult {
+            border-style: none;
+            width: 100%;
+            height: 300px;
+            padding: 5px;
+        }
+        .jspResultHeader {
+            background-color: #818EBD;
+            color: white;
+            width: 100%;
+            height: 15px;
+        }
+        .jspResultHeader span {
+            padding: 5px;
+        }
+        .classSrc {
+            font-family:Courier;
+            font-size:11px;
+            line-height:13px;
+            overflow: auto; 
+            height: 400px;
+            width: 100%;
+        }
+        .tabContainer {
+            width: 1000px;
+            margin: 0 auto;
+        }
+        .guideContainer {
+            width: 600px;
+            border-width: 1px;
+            border-style: solid;
+            margin: 0 auto;
+        }
+        .guide {
+            padding: 5px;
+        }
+    </style>
+</head>
+
+<sx:bind id="guideBind" targets="guide" listenTopics="/loadContent"/>
+
+<body>
+    <sx:tabbedpanel id="mainTabContainer" cssClass="tabContainer">
+        <sx:div label="OGNL Console" id="ognlTab">
+            <div id="shell" class="shell">
+               <form onsubmit="return false">
+                    <div class="wc-results" id="wc-result">
+                         Welcome to the OGNL console!
+                         <br />
+                         :-&gt;
+                    </div>
+                    OGNL Expression <input onkeyup="keyEvent(event, '${jspEval}')" class="wc-command" id="wc-command" type="text" />
+                </form>
+            </div>
+        </sx:div>
+        <sx:div label="JSP Console" id="jspTab">
+            <table style="width: 100%" cellpadding="1">
+                <tr valign="top">
+                    <td width="50%">
+                       <form theme="simple" namespace="/nodecorate" action="jspEval" method="post">
+                           <s:textarea cssClass="jsp" theme="simple" name="jsp" />
+                           <sx:submit
+                                value="Eval JSP Fragment" 
+                                href="%{#jspEval}" 
+                                targets="jspResult" 
+                                highlightColor="#818EBD"
+                                listenTopics="/evalJSP"/>
+                       </form>
+                    </td>
+                    <td width="50%">
+                        <div class="jspResultHeader">
+                            <span>JSP Eval Result</span>
+                        </div>
+                        <div id="jspResult" class="jspResult">
+                        </div>
+                    </td>
+                </tr>
+            </table>    
+        </sx:div>
+        <sx:div label="Class on top of the Value Stack" id="classTab">
+            <div id="classSrc" class="classSrc">
+            </div>
+        </sx:div>
+    </sx:tabbedpanel>
+    <br/><br/>
+    <div class="guideContainer">
+        <div class="jspResultHeader">
+            <span>Interactive Guide</span>
+        </div>
+        <sx:div id="guide" listenTopics="/reloadGuide" cssClass="guide">
+            <p><a href="#" onclick="startOgnl()">Start OGNL Interactive Demo</a></p>
+            <p><a href="#" onclick="startJSP()">Start JSP Interactive Demo</a></p>
+        </sx:div>   
+        <div>
+            <a href="#" id="previous" onclick="change(-1)" style="float: left"><< Previous</a>
+            <a href="#" id="next" onclick="change(1)" style="float: right">Next >></a>
+        </div>
+    </div>
+</body>
+
+</html>
\ No newline at end of file

Added: struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/jsp_0.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/jsp_0.jsp?view=auto&rev=545816
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/jsp_0.jsp (added)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/jsp_0.jsp Sat Jun  9 16:55:37 2007
@@ -0,0 +1,23 @@
+<%
+    request.setAttribute("decorator", "none");
+    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
+    response.setHeader("Pragma","no-cache"); //HTTP 1.0
+    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
+%>
+<p>
+    <b>Accessing properites</b>
+</p>
+<p>
+    On the OGNL demo you learned how to access values from the Value Stack using OGNL expressions.
+    The <i>property</i> tag is used to print to the page, the result of an OGNL expression. The expression
+    is specified in the <i>value</i> attribute.
+</p>
+<p>To print the value of the expression <i>name</i> to the page type
+<p>
+    <i id="example">
+        &lt;s:property value=&quot;name&quot; /&gt;
+    </i>
+</p>
+<p>
+    on the JSP console and hit enter. <a href="#" onclick="evalJSP()">Do it for me</a>
+</p>
\ No newline at end of file

Added: struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_0.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_0.jsp?view=auto&rev=545816
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_0.jsp (added)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_0.jsp Sat Jun  9 16:55:37 2007
@@ -0,0 +1,29 @@
+<%
+    request.setAttribute("decorator", "none");
+    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
+    response.setHeader("Pragma","no-cache"); //HTTP 1.0
+    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
+%>
+<p>
+    <b>Accessing properites</b>
+</p>
+<p>
+    The framework uses a standard naming context to evaluate OGNL expressions. 
+    The top level object dealing with OGNL is a Map (usually referred as a context map or context).
+    OGNL has a notion of there being a root (or default) object within the context. 
+    In OGNL expressions, the properties of the root object can be referenced without any special "marker" notion.
+    References to other objects are marked with a pound sign (#).
+    
+    In this example (and in your JSP pages) the last action executed will be on the top of the stack. 
+</p>
+<p>    
+    <a href="#" onclick="selectClassSrcTab()">This action</a> is available on the third tab above. To access the <i>name</i> field enter:
+</p>
+<p>
+    <i id="example">
+        name
+    </i>
+</p>
+<p>
+    on the OGNL console and hit enter. <a href="#" onclick="execOgnl()">Do it for me</a>
+</p>
\ No newline at end of file

Added: struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_1.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_1.jsp?view=auto&rev=545816
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_1.jsp (added)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_1.jsp Sat Jun  9 16:55:37 2007
@@ -0,0 +1,24 @@
+<%
+    request.setAttribute("decorator", "none");
+    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
+    response.setHeader("Pragma","no-cache"); //HTTP 1.0
+    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
+%>
+<p>
+    <b>Accessing nested properites</b>
+</p>
+<p>
+    To access nested properties, use the dot "." operator to concatenate the property names. The action
+    class has a <i>book</i> field, with <i>title</i> and <i>author</i> fields.
+</p>
+<p>
+    To access the name of the book type:
+</p>
+<p>
+    <i id="example">
+        book.title
+    </i>
+</p>
+<p>
+    on the OGNL console and hit enter. <a href="#" onclick="execOgnl()">Do it for me</a>
+</p>
\ No newline at end of file

Added: struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_2.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_2.jsp?view=auto&rev=545816
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_2.jsp (added)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_2.jsp Sat Jun  9 16:55:37 2007
@@ -0,0 +1,39 @@
+<%
+    request.setAttribute("decorator", "none");
+    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
+    response.setHeader("Pragma","no-cache"); //HTTP 1.0
+    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
+%>
+<p>
+    <b>Accessing properties inside Arrays</b>
+</p>
+<p>
+    To access properties inside arrays, use the brackets "[]" operators with the desired index(starting from 0). The action
+    class has an array of String in the field <i>bands</i>.
+</p>
+<p>
+    To access the second element in the <i>bands</i> array type:
+</p>
+<p>
+    <i id="example0">
+        bands[1]
+    </i>
+</p>
+<p>
+    on the OGNL console and it enter. <a href="#" onclick="execOgnl('example0')">Do it for me</a>
+</p>
+<p>
+    <b>Accessing properties inside Lists</b>
+</p>
+<p>Lists can be accessed on the same way. The action class has a List of String on the field <i>movies</i>.</p>
+<p>
+    To access the first element in the <i>movies</i> list type:
+</p>
+<p>
+    <i id="example1">
+        movies[0]
+    </i>
+</p>
+<p>
+    on the OGNL console and hit enter.  <a href="#" onclick="execOgnl('example1')">Do it for me</a>
+</p>

Added: struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_3.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_3.jsp?view=auto&rev=545816
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_3.jsp (added)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_3.jsp Sat Jun  9 16:55:37 2007
@@ -0,0 +1,50 @@
+<%
+    request.setAttribute("decorator", "none");
+    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
+    response.setHeader("Pragma","no-cache"); //HTTP 1.0
+    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
+%>
+<p>
+    <b>Accessing properties inside Maps</b>
+</p>
+<p>
+    To access properties inside maps, use the brackets "[]" operators with the desired key. The action
+    class has a map of Book objects in the field <i>books</i>.
+</p>
+<p>
+    To access the book with key "Iliad" in the <i>books</i> map type:
+</p>
+<p>
+    <i id="example0">
+        books['Iliad']
+    </i>
+</p>
+<p>
+    on the OGNL console and hit enter. <a href="#" onclick="execOgnl('example0')">Do it for me</a>
+</p>
+<p>If the key does not have spaces in it, you can access an element in the map, using the dot "." operator.</p>
+<p>
+    To access the book with key "Iliad" in the <i>books</i> map type:
+</p>
+<p>
+    <i id="example1">
+        books.Iliad
+    </i>
+</p>
+<p>
+    on the OGNL console and hit enter. <a href="#" onclick="execOgnl('example1')">Do it for me</a>
+</p>
+<p>
+    Note that the object returned is of type Book. If you want to access one of its properties, you can do so using the dot
+    "." operator as you did before.</p>
+<p>
+    To access the <i>author</i> property of the book with key "Iliad" in the <i>books</i> map type:
+</p>
+<p>
+    <i id="example2">
+        books['Iliad'].author
+    </i>
+</p>
+<p>
+    on the OGNL console and hit enter. <a href="#" onclick="execOgnl('example2')">Do it for me</a>
+</p>

Added: struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_4.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_4.jsp?view=auto&rev=545816
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_4.jsp (added)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/interactive/ognl_4.jsp Sat Jun  9 16:55:37 2007
@@ -0,0 +1,28 @@
+<%
+    request.setAttribute("decorator", "none");
+    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
+    response.setHeader("Pragma","no-cache"); //HTTP 1.0
+    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
+%>
+<p>
+    <b>Accessing properites</b>
+</p>
+<p>
+   Object that are not on the top of the Value Stack are accessed using the "#name" notation. 
+   Some objects are always pushed into the stack by Struts, like:
+</p>
+<ul>
+    <li>#application</li>
+    <li>#session</li>
+    <li>#request</li>
+    <li>#parameters</li>
+</ul>
+<p>To see the value os the parameters type</p>
+<p>
+    <i id="example">
+        #parameters
+    </i>
+</p>
+<p>
+    on the OGNL console and it enter.  <a href="#" onclick="execOgnl()">Do it for me</a>
+</p>
\ No newline at end of file