adding spring example

git-svn-id: https://svn.apache.org/repos/asf/myfaces/extensions/scripting/trunk@1401682 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8239b52
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,19 @@
+target/
+.svn
+out/
+*.iwr
+*.iml
+*.ipr
+*.iws
+groovy-bin/*
+*.class
+*.jar
+*.*~
+.project
+.classpath
+.idea
+atlassian-ide-plugin.xml
+pom.xml.versionsBackup
+
+
+
diff --git a/extscript-core-root/extscript-spring/pom.xml b/extscript-core-root/extscript-spring/pom.xml
new file mode 100644
index 0000000..5c81d0c
--- /dev/null
+++ b/extscript-core-root/extscript-spring/pom.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>extscript-spring</artifactId>
+    <version>1.0.5-SNAPSHOT</version>
+    <packaging>jar</packaging>
+    <name>MyFaces Extension Scripting Core</name>
+
+    <description>
+        Extension Scripting Spring Submodule
+    </description>
+
+</project>
\ No newline at end of file
diff --git a/extscript-examples/myfaces20-extscript-helloworld/pom.xml b/extscript-examples/myfaces20-extscript-helloworld/pom.xml
index 3a7a5d8..8fef19e 100644
--- a/extscript-examples/myfaces20-extscript-helloworld/pom.xml
+++ b/extscript-examples/myfaces20-extscript-helloworld/pom.xml
@@ -96,7 +96,5 @@
             <scope>compile</scope>
         </dependency>
 
-
-
     </dependencies>
 </project>
diff --git a/extscript-examples/pom.xml b/extscript-examples/pom.xml
index 3c1f7bc..5f395bd 100644
--- a/extscript-examples/pom.xml
+++ b/extscript-examples/pom.xml
@@ -80,6 +80,7 @@
         <module>myfaces20-extscript-helloworld</module>
         <module>blog-example</module>
         <module>cdi-example</module>
+        <module>spring-example</module>
         <!--
         <module>spring-example</module>
         -->
diff --git a/extscript-examples/spring-example/pom.xml b/extscript-examples/spring-example/pom.xml
new file mode 100644
index 0000000..da0327b
--- /dev/null
+++ b/extscript-examples/spring-example/pom.xml
@@ -0,0 +1,55 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <artifactId>extscript-examples</artifactId>
+        <groupId>org.apache.myfaces.extensions.scripting</groupId>
+        <version>1.0.5-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.myfaces.extensions.scripting</groupId>
+    <artifactId>spring-example</artifactId>
+    <packaging>war</packaging>
+    <name>A simple project for MyFaces 2.0 and Ext-Scripting 1.0 and Spring</name>
+    <version>1.0.5-SNAPSHOT</version>
+    <url>http://www.apache.org</url>
+
+    <dependencies>
+        <!--
+                   optional Groovy include,
+                   if we leave it out, Groovy support is disabled
+                   and only java support will work
+               -->
+        <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy-all</artifactId>
+            <version>${groovy.version}</version>
+        </dependency>
+
+        <!--
+            Note this is the only dependency we need
+            for ext-scripting, the include is a so called
+            meta bundle, which includes the entire
+            ext-scripting core+java6 support + myfaces 2 support
+        -->
+        <dependency>
+            <groupId>org.apache.myfaces.extensions.scripting</groupId>
+            <artifactId>extscript-myfaces20-bundle</artifactId>
+            <version>1.0.5-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-api</artifactId>
+            <version>${myfaces2.version}</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-impl</artifactId>
+            <version>${myfaces2.version}</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/extscript-examples/spring-example/src/main/java/org/apache/myfaces/extension/scripting/spring/example/Greeter.java b/extscript-examples/spring-example/src/main/java/org/apache/myfaces/extension/scripting/spring/example/Greeter.java
new file mode 100644
index 0000000..c3ed34d
--- /dev/null
+++ b/extscript-examples/spring-example/src/main/java/org/apache/myfaces/extension/scripting/spring/example/Greeter.java
@@ -0,0 +1,26 @@
+package org.apache.myfaces.extension.scripting.spring.example;
+
+/**
+ *
+ */
+public class Greeter {
+
+    private Person person;
+
+    public void setPerson(Person person) {
+        this.person = person;
+    }
+
+    public String getGreeting() {
+        return "Salut " + person.getName() + "!";
+    }
+
+    public String getPersonalGreeting() {
+       return "Hi " + person.getFirstName() + "!";
+    }
+
+    public String getAnotherGreeting() {
+        return "Hi World";
+    }
+
+}
diff --git a/extscript-examples/spring-example/src/main/java/org/apache/myfaces/extension/scripting/spring/example/Person.java b/extscript-examples/spring-example/src/main/java/org/apache/myfaces/extension/scripting/spring/example/Person.java
new file mode 100644
index 0000000..6100efb
--- /dev/null
+++ b/extscript-examples/spring-example/src/main/java/org/apache/myfaces/extension/scripting/spring/example/Person.java
@@ -0,0 +1,33 @@
+package org.apache.myfaces.extension.scripting.spring.example;
+
+public class Person {
+
+    private String name;
+
+    private int age;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getAge() {
+        return age;
+    }
+
+    public void setAge(int age) {
+        this.age = age;
+    }
+
+    public String getFirstName() {
+        return getName().split(" ")[0];
+    }
+
+    public String getLastName() {
+        return getName().split(" ")[1];
+    } 
+
+}
diff --git a/extscript-examples/spring-example/src/main/webapp/WEB-INF/faces-config.xml b/extscript-examples/spring-example/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..f0da5d4
--- /dev/null
+++ b/extscript-examples/spring-example/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,13 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE faces-config PUBLIC
+  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
+  "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+<faces-config>
+
+    <application>
+        <variable-resolver>
+            org.springframework.web.jsf.DelegatingVariableResolver
+        </variable-resolver>
+    </application>
+
+</faces-config>
\ No newline at end of file
diff --git a/extscript-examples/spring-example/src/main/webapp/WEB-INF/spring-config.xml b/extscript-examples/spring-example/src/main/webapp/WEB-INF/spring-config.xml
new file mode 100644
index 0000000..66a95b6
--- /dev/null
+++ b/extscript-examples/spring-example/src/main/webapp/WEB-INF/spring-config.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean id="person" class="at.irian.Person" scope="prototype">
+        <property name="name" value="Lukas Huemer" />
+    </bean>
+
+    <bean id="greeter" class="at.irian.Greeter">
+        <property name="person" ref="person" />
+    </bean>
+
+</beans>
\ No newline at end of file
diff --git a/extscript-examples/spring-example/src/main/webapp/WEB-INF/web.xml b/extscript-examples/spring-example/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..36ab771
--- /dev/null
+++ b/extscript-examples/spring-example/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+            http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+  <context-param>
+    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+    <param-value>server</param-value>
+  </context-param>
+
+  <servlet>
+    <servlet-name>Faces Servlet</servlet-name>
+    <servlet-class>
+        javax.faces.webapp.FacesServlet
+    </servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>Faces Servlet</servlet-name>
+    <url-pattern>/faces/*</url-pattern>
+    <url-pattern>*.jsf</url-pattern>
+  </servlet-mapping>
+
+  <context-param>
+    <param-name>contextConfigLocation</param-name>
+    <param-value>/WEB-INF/spring-config.xml</param-value>
+  </context-param>
+
+  <context-param>
+    <param-name>sourcePathLocation</param-name>
+    <param-value>/home/bhuemer/Projects/spring-scripting/spring-scripting-usecase/src/main/java</param-value>
+  </context-param>
+
+  <listener>
+    <listener-class>
+      at.irian.springframework.extensions.scripting.context.CompilationAwareContextLoaderListener
+    </listener-class>
+  </listener>
+
+</web-app>
diff --git a/extscript-examples/spring-example/src/main/webapp/home.jsp b/extscript-examples/spring-example/src/main/webapp/home.jsp
new file mode 100644
index 0000000..c7abb6d
--- /dev/null
+++ b/extscript-examples/spring-example/src/main/webapp/home.jsp
@@ -0,0 +1,21 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+
+<html>
+ <head>
+  <title>Scripting Test</title>
+ </head>
+ <body>
+   <f:view>
+     <h1>
+      <h:outputText value="From JSF: The greeter says '#{greeter.greeting}' to '#{person.name}'."/> <br/>
+      <h:outputText value="From JSF: The greeter says '#{greeter.anotherGreeting}'."/> <br/>
+     </h1>
+
+     <h:form id="helloForm">
+        <h:commandButton action="reload" value="Reload" />
+     </h:form>
+       
+   </f:view>
+ </body>
+</html>
diff --git a/extscript-examples/spring-example/src/main/webapp/index.jsp b/extscript-examples/spring-example/src/main/webapp/index.jsp
new file mode 100644
index 0000000..4f567cf
--- /dev/null
+++ b/extscript-examples/spring-example/src/main/webapp/index.jsp
@@ -0,0 +1,4 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+    response.sendRedirect("home.jsf");
+%>
\ No newline at end of file