Author: rich
Date: Tue May 10 12:50:30 2005
New Revision: 169513

URL: http://svn.apache.org/viewcvs?rev=169513&view=rev
Log:
Fix for http://issues.apache.org/jira/browse/BEEHIVE-631 : Message Bundles for 
Form Beans no longer seem to work

tests: bvt in netui (WinXP)
BB: self (linux)


Added:
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/bugs/j631/
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/bugs/j631/FormBeanMessages.properties
   (with props)
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j631/
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j631/Controller.jpf 
  (with props)
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j631/index.jsp  
 (with props)
    incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J631.xml  
 (with props)
Modified:
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java
    
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ErrorBaseTag.java
    
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties
    
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
    incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/B36628.xml

Modified: 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java?rev=169513&r1=169512&r2=169513&view=diff
==============================================================================
--- 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java
 Tue May 10 12:50:30 2005
@@ -138,6 +138,7 @@
                     assert request instanceof HttpServletRequest : 
request.getClass().getName();
                     InternalUtils.selectModule( 
flowController.getModuleConfig().getPrefix(),
                                                ( HttpServletRequest ) request, 
getServletContext() );
+                    PageFlowRequestWrapper.get( request 
).setCurrentFlowController( flowController );
                 }
             }
             

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ErrorBaseTag.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ErrorBaseTag.java?rev=169513&r1=169512&r2=169513&view=diff
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ErrorBaseTag.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ErrorBaseTag.java
 Tue May 10 12:50:30 2005
@@ -149,7 +149,7 @@
             //
             if (message == null) {
                 if (bundleName == null && missingUserDefaultMessages) {
-                    String s = Bundle.getString("Tags_ErrorsBundleMissing", 
null);
+                    String s = Bundle.getString("Tags_ErrorsBundleMissing", 
key);
                     registerTagError(s, null);
                     return null;
                 }
@@ -185,7 +185,8 @@
      */
     protected static boolean isMissingUserDefaultMessages(PageContext 
pageContext)
     {
-        return 
isMissingUserDefaultMessages(RequestUtils.getModuleConfig(pageContext));
+        return 
isMissingUserDefaultMessages(RequestUtils.getModuleConfig(pageContext))
+               && pageContext.getRequest().getAttribute(Globals.MESSAGES_KEY) 
== null;
     }
 
     /**

Modified: 
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties?rev=169513&r1=169512&r2=169513&view=diff
==============================================================================
--- 
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties
 (original)
+++ 
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties
 Tue May 10 12:50:30 2005
@@ -110,7 +110,7 @@
 Tags_formatDate_Type_Error=The type "{0}" may not be formatted by a formatDate 
tag.
 Tags_LocaleRequiresLanguage=If you set a country, you must also set a language 
when specifying a local, defaulting to Locale of Request.  The country set was 
"{0}"
 Tags_ErrorsException=An error occurred accessing the message bundle.  This may 
be because the message-resource is not defined within the page flow.  The 
error: {0}
-Tags_ErrorsBundleMissing=An error occurred accessing the message bundle.  This 
may be because there is no default message bundle defined for the current page 
flow.
+Tags_ErrorsBundleMissing=An error occurred accessing the message bundle when 
looking for message key "{0}".  This may be because there is no default message 
bundle defined for the current page flow.
 Tags_ErrorsMessageMissing=Could not find a message for message key "{0}" in 
the default message bundle for the current page flow.
 Tags_ParameterRenderError=The parameter type [{0}] was not recognized as a 
valid type.
 Tags_ParameterAccessError=The parameter type [{0}] was not recognized as a 
valid type, attempting to access argument ''{1}''.

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/bugs/j631/FormBeanMessages.properties
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/bugs/j631/FormBeanMessages.properties?rev=169513&view=auto
==============================================================================
--- 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/bugs/j631/FormBeanMessages.properties
 (added)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/bugs/j631/FormBeanMessages.properties
 Tue May 10 12:50:30 2005
@@ -0,0 +1,3 @@
+required=(got the message from bugs.j631.FormBeanMessages.properties)
+error.prefix=<span style="color:red">
+error.suffix=</span>

Propchange: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/bugs/j631/FormBeanMessages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j631/Controller.jpf
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j631/Controller.jpf?rev=169513&view=auto
==============================================================================
--- 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j631/Controller.jpf 
(added)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j631/Controller.jpf 
Tue May 10 12:50:30 2005
@@ -0,0 +1,42 @@
+package bugs.j631;
+
+import org.apache.beehive.netui.pageflow.*;
+import org.apache.beehive.netui.pageflow.annotations.*;
+
[EMAIL PROTECTED](
+    simpleActions={
+        @Jpf.SimpleAction(name="begin", path="index.jsp")
+    }
+)
+public class Controller extends PageFlowController
+{
+    @Jpf.Action(
+        forwards={
+            @Jpf.Forward(name="index", path="index.jsp")
+        },
+        [EMAIL PROTECTED](name="failure", path="index.jsp")
+    )
+    public Forward submit( MyForm form )
+    {
+        return new Forward( "index" );
+    }
+
+    @Jpf.FormBean(messageBundle="bugs.j631.FormBeanMessages")
+    public static class MyForm implements java.io.Serializable
+    {
+        private String _foo;
+
+        @Jpf.ValidatableProperty(
+            [EMAIL PROTECTED](messageKey="required")
+        )
+        public String getFoo()
+        {
+            return _foo;
+        }
+
+        public void setFoo( String foo )
+        {
+            _foo = foo;
+        }
+    }
+}

Propchange: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j631/Controller.jpf
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j631/index.jsp
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j631/index.jsp?rev=169513&view=auto
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j631/index.jsp 
(added)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j631/index.jsp 
Tue May 10 12:50:30 2005
@@ -0,0 +1,28 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+<%@ taglib prefix="netui-data" 
uri="http://beehive.apache.org/netui/tags-databinding-1.0"%>
+<%@ taglib prefix="netui-template" 
uri="http://beehive.apache.org/netui/tags-template-1.0"%>
+
+
+<netui:html>
+    <head>
+        <netui:base/>
+    </head>
+    <netui:body>
+        <h3>${pageFlow.URI}</h3>
+
+        The "required" validation error comes out of the message bundle 
associated with the
+        form bean.  There is no default message bundle associated with the 
page flow.
+        <br/>
+        <br/>
+
+        <netui:form action="submit">
+            (leave this blank and click Submit): <netui:textBox 
dataSource="actionForm.foo"/><netui:error key="foo"/>
+            <br/>
+            <netui:button value="Submit"/>
+        </netui:form>
+    </netui:body>
+</netui:html>
+
+  
+

Propchange: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j631/index.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml?rev=169513&r1=169512&r2=169513&view=diff
==============================================================================
--- 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
 (original)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
 Tue May 10 12:50:30 2005
@@ -4489,6 +4489,15 @@
          </categories>
       </test>
       <test>
+         <name>J631</name>
+         <description>Test to ensure that form bean message resources (from 
@Jpf.FormBean) are used even when the current page flow has no default message 
resources.</description>
+         <webapp>coreWeb</webapp>
+         <categories>
+            <category>bvt</category>
+            <category>jiraBugs</category>
+         </categories>
+      </test>
+      <test>
          <name>JpfScopedFormsTest49</name>
          <description>JpfScopedFormsTest49</description>
          <webapp>coreWeb</webapp>

Modified: 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/B36628.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/B36628.xml?rev=169513&r1=169512&r2=169513&view=diff
==============================================================================
--- 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/B36628.xml 
(original)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/B36628.xml 
Tue May 10 12:50:30 2005
@@ -168,7 +168,7 @@
     <div> <hr /><table border="1" cellspacing="0" 
style="color:red;background-color:white">
  <tr><th colspan="6">Page Errors</th></tr>
  <tr><th>Error Number</th><th>Tag Type</th><th colspan="4">Error</th></tr>
-<tr><th>1</th><th>Errors</th><th>Message</th><td>An error occurred accessing 
the message bundle.  This may be because there is no default message bundle 
defined for the current page flow.</td></tr>
+<tr><th>1</th><th>Errors</th><th>Message</th><td>An error occurred accessing 
the message bundle when looking for message key "theMessage".  This may be 
because there is no default message bundle defined for the current page 
flow.</td></tr>
 </table></div>
 </body>
 
@@ -341,7 +341,7 @@
      <div> <hr /><table border="1" cellspacing="0" 
style="color:red;background-color:white">
  <tr><th colspan="6">Page Errors</th></tr>
  <tr><th>Error Number</th><th>Tag Type</th><th colspan="4">Error</th></tr>
-<tr><th>1</th><th>Error</th><th>Message</th><td>An error occurred accessing 
the message bundle.  This may be because there is no default message bundle 
defined for the current page flow.</td></tr>
+<tr><th>1</th><th>Error</th><th>Message</th><td>An error occurred accessing 
the message bundle when looking for message key "theMessageTwo".  This may be 
because there is no default message bundle defined for the current page 
flow.</td></tr>
 </table></div>
 </body>
 
@@ -441,4 +441,4 @@
    <ses:testCount>5</ses:testCount>
    <ses:passedCount>0</ses:passedCount>
    <ses:failedCount>5</ses:failedCount>
-</ses:recorderSession>
\ No newline at end of file
+</ses:recorderSession>

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J631.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J631.xml?rev=169513&view=auto
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J631.xml 
(added)
+++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J631.xml 
Tue May 10 12:50:30 2005
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ses:recorderSession 
xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session";>
+   <ses:sessionName>J631</ses:sessionName>
+   <ses:tester>rich</ses:tester>
+   <ses:startDate>10 May 2005, 01:15:31.558 PM MDT</ses:startDate>
+   <ses:description>Test to ensure that form bean message resources (from 
@Jpf.FormBean) are used even when the current page flow has no default message 
resources.</ses:description>
+   <ses:tests>
+      <ses:test>
+         <ses:testNumber>1</ses:testNumber>
+         <ses:request>
+            <ses:protocol>HTTP</ses:protocol>
+            <ses:protocolVersion>1.1</ses:protocolVersion>
+            <ses:host>localhost</ses:host>
+            <ses:port>8080</ses:port>
+            <ses:uri>/coreWeb/bugs/j631/Controller.jpf</ses:uri>
+            <ses:method>GET</ses:method>
+            <ses:parameters/>
+            <ses:cookies>
+               <ses:cookie>
+                  <ses:name>JSESSIONID</ses:name>
+                  <ses:value>EB32183B5E9DB216FB2426B4CB780F46</ses:value>
+               </ses:cookie>
+            </ses:cookies>
+            <ses:headers>
+               <ses:header>
+                  <ses:name>accept</ses:name>
+                  
<ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>accept-charset</ses:name>
+                  <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>accept-encoding</ses:name>
+                  <ses:value>gzip,deflate</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>accept-language</ses:name>
+                  <ses:value>en-us,en;q=0.5</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>connection</ses:name>
+                  <ses:value>keep-alive</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>cookie</ses:name>
+                  
<ses:value>JSESSIONID=EB32183B5E9DB216FB2426B4CB780F46</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>host</ses:name>
+                  <ses:value>localhost:8080</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>keep-alive</ses:name>
+                  <ses:value>300</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>user-agent</ses:name>
+                  <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; 
rv:1.7.7) Gecko/20050414 Firefox/1.0.3</ses:value>
+               </ses:header>
+            </ses:headers>
+         </ses:request>
+         <ses:response>
+            <ses:statusCode>200</ses:statusCode>
+            <ses:reason/>
+            <ses:responseBody><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 
4.01 Transitional//EN"
+       "http://www.w3.org/TR/html4/loose.dtd";>
+<html lang="en">
+
+    <head>
+        <base href="http://localhost:8080/coreWeb/bugs/j631/index.jsp";>
+    </head>
+    <body>
+        <h3>/bugs/j631/Controller.jpf</h3>
+
+        The "required" validation error comes out of the message bundle 
associated with the
+        form bean.  There is no default message bundle associated with the 
page flow.
+        <br/>
+        <br/>
+
+        <form action="/coreWeb/bugs/j631/submit.do" method="post">
+            (leave this blank and click Submit): <input type="text" 
name="{actionForm.foo}">
+            <br/>
+            <input type="submit" value="Submit">
+        </form>
+    </body>
+
+</html>]]></ses:responseBody>
+         </ses:response>
+      </ses:test>
+      <ses:test>
+         <ses:testNumber>2</ses:testNumber>
+         <ses:request>
+            <ses:protocol>HTTP</ses:protocol>
+            <ses:protocolVersion>1.1</ses:protocolVersion>
+            <ses:host>localhost</ses:host>
+            <ses:port>8080</ses:port>
+            <ses:uri>/coreWeb/bugs/j631/submit.do</ses:uri>
+            <ses:method>POST</ses:method>
+            <ses:parameters>
+               <ses:parameter>
+                  <ses:name>{actionForm.foo}</ses:name>
+                  <ses:value/>
+               </ses:parameter>
+            </ses:parameters>
+            <ses:cookies>
+               <ses:cookie>
+                  <ses:name>JSESSIONID</ses:name>
+                  <ses:value>EB32183B5E9DB216FB2426B4CB780F46</ses:value>
+               </ses:cookie>
+            </ses:cookies>
+            <ses:headers>
+               <ses:header>
+                  <ses:name>accept</ses:name>
+                  
<ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>accept-charset</ses:name>
+                  <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>accept-encoding</ses:name>
+                  <ses:value>gzip,deflate</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>accept-language</ses:name>
+                  <ses:value>en-us,en;q=0.5</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>connection</ses:name>
+                  <ses:value>keep-alive</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>content-length</ses:name>
+                  <ses:value>21</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>content-type</ses:name>
+                  <ses:value>application/x-www-form-urlencoded</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>cookie</ses:name>
+                  
<ses:value>JSESSIONID=EB32183B5E9DB216FB2426B4CB780F46</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>host</ses:name>
+                  <ses:value>localhost:8080</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>keep-alive</ses:name>
+                  <ses:value>300</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>referer</ses:name>
+                  
<ses:value>http://localhost:8080/coreWeb/bugs/j631/Controller.jpf</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>user-agent</ses:name>
+                  <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; 
rv:1.7.7) Gecko/20050414 Firefox/1.0.3</ses:value>
+               </ses:header>
+            </ses:headers>
+         </ses:request>
+         <ses:response>
+            <ses:statusCode>200</ses:statusCode>
+            <ses:reason/>
+            <ses:responseBody><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 
4.01 Transitional//EN"
+       "http://www.w3.org/TR/html4/loose.dtd";>
+<html lang="en">
+
+    <head>
+        <base href="http://localhost:8080/coreWeb/bugs/j631/index.jsp";>
+    </head>
+    <body>
+        <h3>/bugs/j631/Controller.jpf</h3>
+
+        The "required" validation error comes out of the message bundle 
associated with the
+        form bean.  There is no default message bundle associated with the 
page flow.
+        <br/>
+        <br/>
+
+        <form action="/coreWeb/bugs/j631/submit.do" method="post">
+            (leave this blank and click Submit): <input type="text" 
name="{actionForm.foo}"><span style="color:red">(got the message from 
bugs.j631.FormBeanMessages.properties)
+</span>
+            <br/>
+            <input type="submit" value="Submit">
+        </form>
+    </body>
+
+</html>]]></ses:responseBody>
+         </ses:response>
+      </ses:test>
+   </ses:tests>
+   <ses:endDate>10 May 2005, 01:15:38.718 PM MDT</ses:endDate>
+   <ses:testCount>2</ses:testCount>
+</ses:recorderSession>

Propchange: 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J631.xml
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to