Title: [waffle-scm] [146] trunk/core/src/main/ruby: minor cleanup of code and index.html for jruby example module

Diff

Modified: trunk/core/src/main/ruby/waffle.rb (145 => 146)

--- trunk/core/src/main/ruby/waffle.rb	2007-06-05 23:09:58 UTC (rev 145)
+++ trunk/core/src/main/ruby/waffle.rb	2007-06-07 04:32:42 UTC (rev 146)
@@ -136,7 +136,11 @@
       @parameters.each_pair do |key, value|
         parts = key.split('.')
         if self.instance_variable_defined? "@#{key}".to_sym
-          self.instance_eval("@#{key} = '#{value}'")
+          begin
+            self.instance_eval("@#{key} = '#{value}'")
+          rescue Exception => e
+            p "ERROR handling request parameter #{key} with value: #{value}\n #{e}"
+          end
         end
       end
     end

Modified: trunk/examples/jruby-example/pom.xml (145 => 146)

--- trunk/examples/jruby-example/pom.xml	2007-06-05 23:09:58 UTC (rev 145)
+++ trunk/examples/jruby-example/pom.xml	2007-06-07 04:32:42 UTC (rev 146)
@@ -1,5 +1,5 @@
 <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">
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.codehaus.waffle</groupId>
@@ -62,7 +62,7 @@
             <configuration>
               <tasks>
                 <echo>Deploying webapp</echo>
-                <copy file="target/${pom.artifactId}.war" todir="${webapp.deploy.dir}" verbose="true" overwrite="true" />
+                <copy file="target/${pom.artifactId}.war" todir="${webapp.deploy.dir}" verbose="true" overwrite="true"/>
               </tasks>
             </configuration>
             <goals>

Modified: trunk/examples/jruby-example/resources/editperson.jspx (145 => 146)

--- trunk/examples/jruby-example/resources/editperson.jspx	2007-06-05 23:09:58 UTC (rev 145)
+++ trunk/examples/jruby-example/resources/editperson.jspx	2007-06-07 04:32:42 UTC (rev 146)
@@ -3,49 +3,49 @@
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:fmt="http://java.sun.com/jsp/jstl/fmt">
 
-    <h3>Edit Person</h3>
+  <h3>Edit Person</h3>
 
-    <!--<c:if test="${errors.errorMessageCount > 0}">
-        <div class="errors">
-            <c:forEach var="error" items="${errors.allErrorMessages}">
-                <div class="error">
-                    ${error.message}
-                </div>
-            </c:forEach>
+  <!--<c:if test="${errors.errorMessageCount > 0}">
+    <div class="errors">
+      <c:forEach var="error" items="${errors.allErrorMessages}">
+        <div class="error">
+          ${error.message}
         </div>
-    </c:if>-->
-
-    <div class="fieldRow">
-        <label for=""
-        <input type="text" name="person.id" id="person.id" value="${person.id}" readonly="true" disabled="true"/>
-        <br style="clear:both"/>
+      </c:forEach>
     </div>
-    <div class="fieldRow">
-        <label for="" Name:</label>
-        <input type="text" name="person.firstName" id="person.firstName" value="${person.firstName}"/>
-        <br style="clear:both"/>
-    </div>
-    <div class="fieldRow">
-        <label for="" Name:</label>
-        <input type="text" name="person.lastName" id="person.lastName" value="${person.lastName}"/>
-        <br style="clear:both"/>
-    </div>
-    <div class="fieldRow">
-        <label for=""
-        <input type="text" name="person.email" id="person.email" value="${person.email}"/>
-        <br style="clear:both"/>
-    </div>
-    <!--<div class="fieldRow">
-        <label for="" of Birth:</label>
-        <fmt:formatDate value="${person.dateOfBirth}" var="birthDate" pattern="dd-MM-yyyy"/>
-        <input type="text" name="person.dateOfBirth" id="person.dateOfBirth" value="${birthDate}"/>
-        <br style="clear:both"/>
-    </div>-->
+  </c:if>-->
 
-    <br/>
-    <a href="" |
-    <a href=""
+  <div class="fieldRow">
+    <label for=""
+    <input type="text" name="person.id" id="person.id" value="${person.id}" readonly="true" disabled="true"/>
+    <br style="clear:both"/>
+  </div>
+  <div class="fieldRow">
+    <label for="" Name:</label>
+    <input type="text" name="person.firstName" id="person.firstName" value="${person.firstName}"/>
+    <br style="clear:both"/>
+  </div>
+  <div class="fieldRow">
+    <label for="" Name:</label>
+    <input type="text" name="person.lastName" id="person.lastName" value="${person.lastName}"/>
+    <br style="clear:both"/>
+  </div>
+  <div class="fieldRow">
+    <label for=""
+    <input type="text" name="person.email" id="person.email" value="${person.email}"/>
+    <br style="clear:both"/>
+  </div>
+  <!--<div class="fieldRow">
+    <label for="" of Birth:</label>
+    <fmt:formatDate value="${person.dateOfBirth}" var="birthDate" pattern="dd-MM-yyyy"/>
+    <input type="text" name="person.dateOfBirth" id="person.dateOfBirth" value="${birthDate}"/>
+    <br style="clear:both"/>
+  </div>-->
 
-    <!--<jsp:directive.include file="fielderrors.jspx"/>-->
+  <br/>
+  <a href="" |
+  <a href=""
 
+  <!--<jsp:directive.include file="fielderrors.jspx"/>-->
+
 </div>
\ No newline at end of file

Modified: trunk/examples/jruby-example/resources/fielderrors.jspx (145 => 146)

--- trunk/examples/jruby-example/resources/fielderrors.jspx	2007-06-05 23:09:58 UTC (rev 145)
+++ trunk/examples/jruby-example/resources/fielderrors.jspx	2007-06-07 04:32:42 UTC (rev 146)
@@ -1,7 +1,7 @@
 <c:forEach items="${errors.allErrorMessages}" var="error"
-        xmlns:c="http://java.sun.com/jsp/jstl/core">
-    <script type="text/_javascript_">
-        $('${error.name}').value = '${error.value}';
-        $('${error.name}').style.border = 'solid red 2px';
-    </script>
+           xmlns:c="http://java.sun.com/jsp/jstl/core">
+  <script type="text/_javascript_">
+    $('${error.name}').value = '${error.value}';
+    $('${error.name}').style.border = 'solid red 2px';
+  </script>
 </c:forEach>
\ No newline at end of file

Modified: trunk/examples/jruby-example/resources/index.html (145 => 146)

--- trunk/examples/jruby-example/resources/index.html	2007-06-05 23:09:58 UTC (rev 145)
+++ trunk/examples/jruby-example/resources/index.html	2007-06-07 04:32:42 UTC (rev 146)
@@ -2,14 +2,20 @@
         "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>
-  <title></title>
+  <title>Waffle and JRuby</title>
+  <style type="text/css" title="currentStyle" media="screen">
+    @import "stylesheets/style.css";
+  </style>
 </head>
 <body>
 <h1>Waffle JRuby example</h1>
 
-<p>
-  <a href="" default method (index) on the Ruby Controller</a><br/>
-  <a href="" the 'bar' method on the Ruby Controller</a><br/>
-</p>
+<p>Welcome to the Waffle/JRuby example. Please try the examples below:</p>
+
+<ul>
+  <li><a href="" default method (index) on the Ruby Controller</a></li>
+  <li><a href="" the 'bar' method on the Ruby Controller</a></li>
+  <li><a href="" Maintenance</a></li>
+</ul>
 </body>
 </html>
\ No newline at end of file

Modified: trunk/examples/jruby-example/resources/person.jspx (145 => 146)

--- trunk/examples/jruby-example/resources/person.jspx	2007-06-05 23:09:58 UTC (rev 145)
+++ trunk/examples/jruby-example/resources/person.jspx	2007-06-07 04:32:42 UTC (rev 146)
@@ -25,7 +25,7 @@
 <body>
 <form action="" method="post">
 
-  <h3>Waffle example: Select Person</h3>
+  <h3>Waffle/JRuby example: Select Person</h3>
 
   <table>
     <tr>

Modified: trunk/examples/jruby-example/src/main/java/org/codehaus/waffle/example/jruby/dao/SimplePersonDAO.java (145 => 146)

--- trunk/examples/jruby-example/src/main/java/org/codehaus/waffle/example/jruby/dao/SimplePersonDAO.java	2007-06-05 23:09:58 UTC (rev 145)
+++ trunk/examples/jruby-example/src/main/java/org/codehaus/waffle/example/jruby/dao/SimplePersonDAO.java	2007-06-07 04:32:42 UTC (rev 146)
@@ -50,6 +50,6 @@
     }
 
     public void delete(Long personId) {
-
+        map.remove(personId);
     }
 }

Modified: trunk/examples/jruby-example/src/main/ruby/ruby/person.rb (145 => 146)

--- trunk/examples/jruby-example/src/main/ruby/ruby/person.rb	2007-06-05 23:09:58 UTC (rev 145)
+++ trunk/examples/jruby-example/src/main/ruby/ruby/person.rb	2007-06-07 04:32:42 UTC (rev 146)
@@ -9,19 +9,18 @@
     render 'person.jspx'
   end
 
-#
-#  def remove(person_id)
-#    @person_dao.delete(person_id)
-#  end
-#
+  def remove(uid)
+    @person_dao.delete(uid.to_i)
+
+    return nil
+  end
+
   def select(uid)
-    p "XXXXXXXXX #{uid}"
     @person = @person_dao.findById(uid.to_i)
 
     return nil
   end
 
-
   def save
     @person_dao.save(@person)
 
@@ -33,10 +32,11 @@
 
     return nil # stay on page
   end
-  
-#
-#  def cancel
-#    @person = null
-#  end
 
+  def cancel
+    @person = nil
+
+    return nil
+  end
+
 end
\ No newline at end of file

Modified: trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml (145 => 146)

--- trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml	2007-06-05 23:09:58 UTC (rev 145)
+++ trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml	2007-06-07 04:32:42 UTC (rev 146)
@@ -13,7 +13,7 @@
     <param-value>org.codehaus.waffle.example.jruby.JRubyRegistrar</param-value>
   </context-param>
 
-  <!-- Ruby Specifics components -->
+  <!-- Ruby Specific components -->
   <context-param>
     <param-name>org.codehaus.waffle.context.ContextContainerFactory</param-name>
     <param-value>org.codehaus.waffle.context.pico.RubyAwarePicoContextContainerFactory</param-value>
@@ -27,6 +27,7 @@
     <param-value>org.codehaus.waffle.controller.RubyControllerDefinitionFactory</param-value>
   </context-param>
 
+  <!-- Define a relative path to the ruby script directory (for development) -->
   <context-param>
     <param-name>org.codehaus.waffle.ruby.path</param-name>
     <param-value>dir:../src/main/ruby/ruby/</param-value><!-- this needs to be more forgiving -->

Modified: trunk/examples/simple-example/resources/index.html (145 => 146)

--- trunk/examples/simple-example/resources/index.html	2007-06-05 23:09:58 UTC (rev 145)
+++ trunk/examples/simple-example/resources/index.html	2007-06-07 04:32:42 UTC (rev 146)
@@ -3,20 +3,20 @@
 <html>
 <head>
   <title>Waffle example</title>
-    <style type="text/css" title="currentStyle" media="screen">
-        @import "stylesheets/style.css";
-    </style>
+  <style type="text/css" title="currentStyle" media="screen">
+    @import "stylesheets/style.css";
+  </style>
 </head>
 <body>
-    <h1>Waffle example</h1>
+<h1>Waffle example</h1>
 
-    <p>Welcome to the Waffle example.  You can play with waffle by trying one of the examples below:</p>
+<p>Welcome to the Waffle example. You can play with waffle by trying one of the examples below:</p>
 
-    <ul>
-        <li><a href="" World</a></li>
-        <li><a href="" World XML</a></li>
-        <li><a href=""
-        <li><a href="" Maintenance</a></li>
-    </ul>
+<ul>
+  <li><a href="" World</a></li>
+  <li><a href="" World XML</a></li>
+  <li><a href=""
+  <li><a href="" Maintenance</a></li>
+</ul>
 </body>
 </html>
\ No newline at end of file


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to