Return-Path: Delivered-To: apmail-incubator-beehive-dev-archive@www.apache.org Received: (qmail 95528 invoked from network); 30 Sep 2004 18:01:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 30 Sep 2004 18:01:06 -0000 Received: (qmail 33060 invoked by uid 500); 30 Sep 2004 18:00:51 -0000 Delivered-To: apmail-incubator-beehive-dev-archive@incubator.apache.org Received: (qmail 32879 invoked by uid 500); 30 Sep 2004 18:00:48 -0000 Mailing-List: contact beehive-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Beehive Developers" Delivered-To: mailing list beehive-dev@incubator.apache.org Received: (qmail 32743 invoked by uid 99); 30 Sep 2004 18:00:46 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [63.96.162.5] (HELO ussjmh01.bea.com) (63.96.162.5) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 30 Sep 2004 11:00:44 -0700 Received: from ussjfe01.amer.bea.com (ussjfe01b.bea.com [172.16.120.57]) by ussjmh01.bea.com (Switch-3.0.5/Switch-3.0.0) with ESMTP id i8UI0fZL023790 for ; Thu, 30 Sep 2004 11:00:41 -0700 Received: from USBOEX01.amer.bea.com ([10.36.32.15]) by ussjfe01.amer.bea.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 30 Sep 2004 11:00:41 -0700 Received: from [10.0.0.100] ([10.36.34.171]) by USBOEX01.amer.bea.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 30 Sep 2004 12:00:40 -0600 Message-ID: <415C49C8.4060600@bea.com> Date: Thu, 30 Sep 2004 12:00:40 -0600 From: Richard Feit User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Beehive Developers Subject: Re: checkin request for netui - declarative validation References: <415B3498.8080508@bea.com> In-Reply-To: <415B3498.8080508@bea.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 30 Sep 2004 18:00:40.0719 (UTC) FILETIME=[65CC49F0:01C4A717] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi Carlin, I looked this over and submitted it. Great catch -- I hadn't known about the Validator requirement (virtual requirement) that the field exist in the default formset. We should just revisit this when we upgrade to Validator 1.1. Thanks, Rich Carlin Rogers wrote: > Hi All, > > I have another checkin request for Page Flow. The following patch > file (output from "svn diff") contains another update for the > declarative validation support. > > Fixes: > - We now create an empty field (place holder) in the default formset > for all form fields with specific Jpf.ValidationLocaleRules annotation. > This will ensure that the specific locale field rules will override > the empty field and be fired at runtime with the commons validator. > - Minor refactoring to update a method signature that had an argument > not being used. > > DRT/BVT: NetUI (WinXP) > BB: self (WinXP) > > Thanks, > Carlin > >------------------------------------------------------------------------ > >Index: netui/test/webapps/drt/testRecorder/tests/ValidateField.xml >=================================================================== >--- netui/test/webapps/drt/testRecorder/tests/ValidateField.xml (revision 0) >+++ netui/test/webapps/drt/testRecorder/tests/ValidateField.xml (revision 0) >@@ -0,0 +1,663 @@ >+ >+ >+ ValidateField >+ crogers >+ 28 Sep 2004, 05:57:59.786 PM MDT >+ Ensure that a specific locale rule on a field (Jpf.ValidationLocaleRules annotation) fires even if there are no default rules defined for the field. >+ >+ >+ 1 >+ >+ HTTP >+ 1.1 >+ localhost >+ 8080 >+ /coreWeb/miniTests/validateField/Controller.jpf >+ GET >+ >+ >+ >+ JSESSIONID >+ 10D5EC33240A31F1F9DE0207A1FB82F4 >+ >+ >+ >+ >+ accept >+ image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* >+ >+ >+ accept-encoding >+ gzip, deflate >+ >+ >+ accept-language >+ en-us,fr-ca;q=0.91,fr;q=0.82,en-scouse;q=0.73,fr-FR-MAC;q=0.64,es;q=0.55,en-ca;q=0.45,en-US-MAC;q=0.36,x-pig-latin;q=0.27,sgn-US-MA;q=0.18,i-klingon;q=0.09 >+ >+ >+ connection >+ Keep-Alive >+ >+ >+ cookie >+ JSESSIONID=10D5EC33240A31F1F9DE0207A1FB82F4 >+ >+ >+ host >+ localhost:8080 >+ >+ >+ user-agent >+ Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) >+ >+ >+ >+ >+ 200 >+ >+ + "http://www.w3.org/TR/html4/loose.dtd"> >+ >+ >+ >+ >+ >+

Declarative Validation Test

>+ >+ Save current locale >+
>+ Change to French locale "fr" >+
>+ Reset locale >+ >+
>+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+
item1: >+ >+ >+ >+
item2: >+ >+ >+ >+
>+
>+   >+ >+
>+
>+ >+ >+]]>
>+
>+
>+ >+ 2 >+ >+ HTTP >+ 1.1 >+ localhost >+ 8080 >+ /coreWeb/miniTests/validateField/saveLocale.do >+ GET >+ >+ >+ >+ JSESSIONID >+ 10D5EC33240A31F1F9DE0207A1FB82F4 >+ >+ >+ >+ >+ accept >+ image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* >+ >+ >+ accept-encoding >+ gzip, deflate >+ >+ >+ accept-language >+ en-us,fr-ca;q=0.91,fr;q=0.82,en-scouse;q=0.73,fr-FR-MAC;q=0.64,es;q=0.55,en-ca;q=0.45,en-US-MAC;q=0.36,x-pig-latin;q=0.27,sgn-US-MA;q=0.18,i-klingon;q=0.09 >+ >+ >+ connection >+ Keep-Alive >+ >+ >+ cookie >+ JSESSIONID=10D5EC33240A31F1F9DE0207A1FB82F4 >+ >+ >+ host >+ localhost:8080 >+ >+ >+ referer >+ http://localhost:8080/coreWeb/miniTests/validateField/Controller.jpf >+ >+ >+ user-agent >+ Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) >+ >+ >+ >+ >+ 200 >+ >+ + "http://www.w3.org/TR/html4/loose.dtd"> >+ >+ >+ >+ >+ >+

Declarative Validation Test

>+ >+ Save current locale >+
>+ Change to French locale "fr" >+
>+ Reset locale >+ >+
>+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+
item1: >+ >+ >+ >+
item2: >+ >+ >+ >+
>+
>+   >+ >+
>+
>+ >+ >+]]>
>+
>+
>+ >+ 3 >+ >+ HTTP >+ 1.1 >+ localhost >+ 8080 >+ /coreWeb/miniTests/validateField/validate.do >+ POST >+ >+ >+ actionOverride:validate >+ Click >+ >+ >+ {actionForm.item1} >+ 1 >+ >+ >+ {actionForm.item2} >+ 1 >+ >+ >+ >+ >+ JSESSIONID >+ 10D5EC33240A31F1F9DE0207A1FB82F4 >+ >+ >+ >+ >+ accept >+ image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* >+ >+ >+ accept-encoding >+ gzip, deflate >+ >+ >+ accept-language >+ en-us,fr-ca;q=0.91,fr;q=0.82,en-scouse;q=0.73,fr-FR-MAC;q=0.64,es;q=0.55,en-ca;q=0.45,en-US-MAC;q=0.36,x-pig-latin;q=0.27,sgn-US-MA;q=0.18,i-klingon;q=0.09 >+ >+ >+ cache-control >+ no-cache >+ >+ >+ connection >+ Keep-Alive >+ >+ >+ content-length >+ 81 >+ >+ >+ content-type >+ application/x-www-form-urlencoded >+ >+ >+ cookie >+ JSESSIONID=10D5EC33240A31F1F9DE0207A1FB82F4 >+ >+ >+ host >+ localhost:8080 >+ >+ >+ referer >+ http://localhost:8080/coreWeb/miniTests/validateField/saveLocale.do >+ >+ >+ user-agent >+ Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) >+ >+ >+ >+ >+ 200 >+ >+ + "http://www.w3.org/TR/html4/loose.dtd"> >+ >+ >+ >+ >+ >+

Declarative Validation Test

>+ >+ Save current locale >+
>+ Change to French locale "fr" >+
>+ Reset locale >+ >+
>+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+
item1: >+ >+ >+ minimum length is 2 characters - All locales >+ >+
item2: >+ >+ >+ >+
>+
>+   >+ >+
>+
>+ minimum length is 2 characters - All locales >+ >+ >+]]>
>+
>+
>+ >+ 4 >+ >+ HTTP >+ 1.1 >+ localhost >+ 8080 >+ /coreWeb/miniTests/validateField/changeLocale.do >+ GET >+ >+ >+ >+ JSESSIONID >+ 10D5EC33240A31F1F9DE0207A1FB82F4 >+ >+ >+ >+ >+ accept >+ image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* >+ >+ >+ accept-encoding >+ gzip, deflate >+ >+ >+ accept-language >+ en-us,fr-ca;q=0.91,fr;q=0.82,en-scouse;q=0.73,fr-FR-MAC;q=0.64,es;q=0.55,en-ca;q=0.45,en-US-MAC;q=0.36,x-pig-latin;q=0.27,sgn-US-MA;q=0.18,i-klingon;q=0.09 >+ >+ >+ connection >+ Keep-Alive >+ >+ >+ cookie >+ JSESSIONID=10D5EC33240A31F1F9DE0207A1FB82F4 >+ >+ >+ host >+ localhost:8080 >+ >+ >+ referer >+ http://localhost:8080/coreWeb/miniTests/validateField/validate.do >+ >+ >+ user-agent >+ Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) >+ >+ >+ >+ >+ 200 >+ >+ + "http://www.w3.org/TR/html4/loose.dtd"> >+ >+ >+ >+ >+ >+

Declarative Validation Test

>+ >+ Save current locale >+
>+ Change to French locale "fr" >+
>+ Reset locale >+ >+
>+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+
item1: >+ >+ >+ >+
item2: >+ >+ >+ >+
>+
>+   >+ >+
>+
>+ >+ >+]]>
>+
>+
>+ >+ 5 >+ >+ HTTP >+ 1.1 >+ localhost >+ 8080 >+ /coreWeb/miniTests/validateField/validate.do >+ POST >+ >+ >+ actionOverride:validate >+ Click >+ >+ >+ {actionForm.item1} >+ 123 >+ >+ >+ {actionForm.item2} >+ 123 >+ >+ >+ >+ >+ JSESSIONID >+ 10D5EC33240A31F1F9DE0207A1FB82F4 >+ >+ >+ >+ >+ accept >+ image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* >+ >+ >+ accept-encoding >+ gzip, deflate >+ >+ >+ accept-language >+ en-us,fr-ca;q=0.91,fr;q=0.82,en-scouse;q=0.73,fr-FR-MAC;q=0.64,es;q=0.55,en-ca;q=0.45,en-US-MAC;q=0.36,x-pig-latin;q=0.27,sgn-US-MA;q=0.18,i-klingon;q=0.09 >+ >+ >+ cache-control >+ no-cache >+ >+ >+ connection >+ Keep-Alive >+ >+ >+ content-length >+ 85 >+ >+ >+ content-type >+ application/x-www-form-urlencoded >+ >+ >+ cookie >+ JSESSIONID=10D5EC33240A31F1F9DE0207A1FB82F4 >+ >+ >+ host >+ localhost:8080 >+ >+ >+ referer >+ http://localhost:8080/coreWeb/miniTests/validateField/changeLocale.do >+ >+ >+ user-agent >+ Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) >+ >+ >+ >+ >+ 200 >+ >+ + "http://www.w3.org/TR/html4/loose.dtd"> >+ >+ >+ >+ >+ >+

Declarative Validation Test

>+ >+ Save current locale >+
>+ Change to French locale "fr" >+
>+ Reset locale >+ >+
>+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+
item1: >+ >+ >+ minimum length is 6 characters - fr locale >+ >+
item2: >+ >+ >+ minimum length is 4 characters - fr locale >+ >+
>+
>+   >+ >+
>+
>+ minimum length is 6 characters - fr locale >+minimum length is 4 characters - fr locale >+ >+ >+]]>
>+
>+
>+ >+ 6 >+ >+ HTTP >+ 1.1 >+ localhost >+ 8080 >+ /coreWeb/miniTests/validateField/resetLocale.do >+ GET >+ >+ >+ >+ JSESSIONID >+ 10D5EC33240A31F1F9DE0207A1FB82F4 >+ >+ >+ >+ >+ accept >+ image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* >+ >+ >+ accept-encoding >+ gzip, deflate >+ >+ >+ accept-language >+ en-us,fr-ca;q=0.91,fr;q=0.82,en-scouse;q=0.73,fr-FR-MAC;q=0.64,es;q=0.55,en-ca;q=0.45,en-US-MAC;q=0.36,x-pig-latin;q=0.27,sgn-US-MA;q=0.18,i-klingon;q=0.09 >+ >+ >+ connection >+ Keep-Alive >+ >+ >+ cookie >+ JSESSIONID=10D5EC33240A31F1F9DE0207A1FB82F4 >+ >+ >+ host >+ localhost:8080 >+ >+ >+ referer >+ http://localhost:8080/coreWeb/miniTests/validateField/validate.do >+ >+ >+ user-agent >+ Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) >+ >+ >+ >+ >+ 200 >+ >+ + "http://www.w3.org/TR/html4/loose.dtd"> >+ >+ >+ >+ >+ >+

Declarative Validation Test

>+ >+ Save current locale >+
>+ Change to French locale "fr" >+
>+ Reset locale >+ >+
>+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+
item1: >+ >+ >+ >+
item2: >+ >+ >+ >+
>+
>+   >+ >+
>+
>+ >+ >+]]>
>+
>+
>+
>+ 28 Sep 2004, 05:58:37.099 PM MDT >+ 6 >+
> >Property changes on: netui/test/webapps/drt/testRecorder/tests/ValidateField.xml >___________________________________________________________________ >Name: svn:eol-style > + native > >Index: netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml >=================================================================== >--- netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml (revision 47488) >+++ netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml (working copy) >@@ -1214,7 +1214,6 @@ > corePageFlow > > >- PageFlow > Form > Validation > >@@ -5174,6 +5173,19 @@ > > > >+ ValidateField >+ Ensure that a specific locale rule on a field (Jpf.ValidationLocaleRules annotation) fires even if there are no default rules defined for the field. >+ coreWeb >+ >+ bvt >+ corePageFlow >+ >+ >+ Form >+ Validation >+ >+ >+ > Validation2 > Tests of basic validation and validation using the Struts ValidatorPlugIn (as well as netui:error, netui:errors). > coreWeb >@@ -5209,7 +5221,6 @@ > corePageFlow > > >- PageFlow > Form > Validation > >Index: netui/test/webapps/drt/coreWeb/miniTests/validateField/Controller.jpf >=================================================================== >--- netui/test/webapps/drt/coreWeb/miniTests/validateField/Controller.jpf (revision 0) >+++ netui/test/webapps/drt/coreWeb/miniTests/validateField/Controller.jpf (revision 0) >@@ -0,0 +1,177 @@ >+/* >+ * Copyright 2004 The Apache Software Foundation. >+ * >+ * Licensed 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. >+ * >+ * $Header:$ >+ */ >+package miniTests.validateField; >+ >+import java.util.Locale; >+import javax.servlet.http.HttpServletRequest; >+import javax.servlet.http.HttpSession; >+import org.apache.struts.action.ActionMapping; >+import org.apache.beehive.netui.pageflow.annotations.Jpf; >+import org.apache.beehive.netui.pageflow.FormData; >+import org.apache.beehive.netui.pageflow.Forward; >+import org.apache.beehive.netui.pageflow.PageFlowController; >+import org.apache.struts.Globals; >+ >+@Jpf.Controller( >+ validatableBeans = { >+ @Jpf.ValidatableBean( >+ type = miniTests.validateField.Controller.ValidateForm.class, >+ validatableProperties = { >+ @Jpf.ValidatableProperty( >+ propertyName = "item1", >+ validateMinLength = >+ @Jpf.ValidateMinLength( >+ chars = 2, >+ message = "minimum length is 2 characters - All locales"), >+ localeRules = { >+ @Jpf.ValidationLocaleRules( >+ language = "fr", >+ country = "", >+ variant = "", >+ validateMinLength = >+ @Jpf.ValidateMinLength( >+ chars = 6, >+ message = "minimum length is 6 characters - fr locale"), >+ validateMaxLength = >+ @Jpf.ValidateMaxLength( >+ chars = 10, >+ message = "maximum length is 10 characters - fr locale") >+ ) >+ } >+ ), >+ @Jpf.ValidatableProperty( >+ propertyName = "item2", >+ localeRules = { >+ @Jpf.ValidationLocaleRules( >+ language = "fr", >+ country = "", >+ variant = "", >+ validateMinLength = >+ @Jpf.ValidateMinLength( >+ chars = 4, >+ message = "minimum length is 4 characters - fr locale") >+ ) >+ } >+ ) >+ } >+ ) >+ } >+) >+public class Controller extends PageFlowController >+{ >+ private Locale savedLocale = null; >+ >+ @Jpf.Action( >+ forwards={ >+ @Jpf.Forward(name="index", path="index.jsp") >+ } >+ ) >+ protected Forward begin() >+ { >+ return new Forward("index"); >+ } >+ >+ >+ /** >+ * Callback that is invoked when this controller instance is created. >+ */ >+ protected void onCreate() >+ { >+ } >+ >+ /** >+ * Callback that is invoked when this controller instance is destroyed. >+ */ >+ protected void onDestroy(HttpSession session) >+ { >+ } >+ >+ >+ @Jpf.Action(forwards = { >+ @Jpf.Forward(name = "success", >+ path = "index.jsp") >+ }, >+ validationErrorForward = @Jpf.Forward(name = "errors", >+ path = "index.jsp")) >+ protected Forward validate(ValidateForm form) >+ { >+ Forward forward = new Forward( "success" ); >+ return forward; >+ } >+ >+ >+ public static class ValidateForm extends FormData >+ { >+ private String _item1; >+ private String _item2; >+ >+ public String getItem1() >+ { return this._item1; } >+ >+ public void setItem1(String item) >+ { this._item1 = item; } >+ >+ public String getItem2() >+ { return this._item2; } >+ >+ public void setItem2(String item) >+ { this._item2 = item; } >+ } >+ >+ >+ @Jpf.Action(forwards = { >+ @Jpf.Forward(name = "success", >+ path = "index.jsp") >+ }) >+ protected Forward saveLocale() >+ { >+ savedLocale = getLocale(); >+ Forward forward = new Forward( "success" ); >+ return forward; >+ } >+ >+ @Jpf.Action(forwards = { >+ @Jpf.Forward(name = "success", >+ path = "index.jsp") >+ }) >+ protected Forward changeLocale() >+ { >+ setLocale( new Locale( "fr" ) ); >+ Forward forward = new Forward( "success" ); >+ return forward; >+ } >+ >+ @Jpf.Action(forwards = { >+ @Jpf.Forward(name = "success", >+ path = "index.jsp") >+ }) >+ protected Forward resetLocale() >+ { >+ setLocale( savedLocale ); >+ Forward forward = new Forward( "success" ); >+ return forward; >+ } >+ >+ public String getLocaleName() >+ { >+ Locale l = ( Locale ) getSession().getAttribute( Globals.LOCALE_KEY ); >+ String localeName = ( l == null ) ? "null" : l.toString(); >+ return localeName; >+ } >+} >+ > >Property changes on: netui/test/webapps/drt/coreWeb/miniTests/validateField/Controller.jpf >___________________________________________________________________ >Name: svn:eol-style > + native > >Index: netui/test/webapps/drt/coreWeb/miniTests/validateField/index.jsp >=================================================================== >--- netui/test/webapps/drt/coreWeb/miniTests/validateField/index.jsp (revision 0) >+++ netui/test/webapps/drt/coreWeb/miniTests/validateField/index.jsp (revision 0) >@@ -0,0 +1,47 @@ >+<%@ page language="java" contentType="text/html;charset=UTF-8"%> >+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%> >+ >+ >+ >+ >+ >+ >+ >+

Declarative Validation Test

>+ >+ Save current locale >+
>+ Change to French locale "fr" >+
>+ Reset locale >+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+ >+
item1: >+ >+ >+ >+
item2: >+ >+ >+ >+
>+
>+   >+ >+
>+
>+ >+
>+
>+ > >Property changes on: netui/test/webapps/drt/coreWeb/miniTests/validateField/index.jsp >___________________________________________________________________ >Name: svn:eol-style > + native > >Index: netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java >=================================================================== >--- netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java (revision 47488) >+++ netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java (working copy) >@@ -35,7 +35,6 @@ > import org.apache.struts.action.ActionForward; > import org.apache.struts.action.ActionMapping; > import org.apache.struts.action.ActionServlet; >-import org.apache.struts.action.Action; > import org.apache.struts.action.ActionErrors; > import org.apache.struts.action.ActionMessages; > import org.apache.struts.config.ActionConfig; >@@ -464,7 +463,7 @@ > ActionForward retVal; > if ( pfActionMapping != null && pfActionMapping.isSimpleAction() ) > { >- retVal = handleSimpleAction( pfActionMapping, form, request, response, servletContext ); >+ retVal = handleSimpleAction( pfActionMapping, form, request, servletContext ); > } > else > { >@@ -1471,8 +1470,9 @@ > PageFlowUtils.addValidationError( propertyName, messageKey, getRequest() ); > } > >- private static ActionForward handleSimpleAction( PageFlowActionMapping mapping, ActionForm wrappedFormBean, >- HttpServletRequest request, HttpServletResponse response, >+ private static ActionForward handleSimpleAction( PageFlowActionMapping mapping, >+ ActionForm wrappedFormBean, >+ HttpServletRequest request, > ServletContext servletContext ) > { > >@@ -1801,7 +1801,7 @@ > > HttpSession session = request.getSession(); > if (locale == null) { >- locale = defaultLocale; >+ locale = getDefaultLocale(); > } > session.setAttribute(Globals.LOCALE_KEY, locale); > >Index: netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidationModel.java >=================================================================== >--- netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidationModel.java (revision 47488) >+++ netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidationModel.java (working copy) >@@ -112,19 +112,38 @@ > localeSet = new LocaleSet( locale ); > _localeSets.put( locale, localeSet ); > } >+ >+ // >+ // The Commons Validator uses specific locale rules for a field only if there >+ // is a rule for the same field in the default formset. Therefor, we need to >+ // keep a place holder for each locale specific field we find in the default >+ // formset entity so that the Commons Validator will behave as desired. >+ // >+ if ( getField( ruleInfo, _defaultLocaleSet ) == null ) >+ { >+ // >+ // create a simple placeholder for the field, without any rules >+ // >+ addFieldRule( ruleInfo, ( ValidatorRule ) null, _defaultLocaleSet ); >+ } > } > > addFieldRule( ruleInfo, rule, localeSet ); > } >- >- private boolean hasFieldRule( RuleInfo ruleInfo, ValidatorRule rule, LocaleSet localeSet ) >+ >+ private ValidatableField getField( RuleInfo ruleInfo, LocaleSet localeSet ) > { > String entityName = ruleInfo.getEntityName(); > ValidatableEntity entity = localeSet.getEntity( entityName ); >- if ( entity == null ) { return false ; } >+ if ( entity == null ) { return null; } > > String fieldName = ruleInfo.getFieldName(); >- ValidatableField field = entity.getField( fieldName ); >+ return entity.getField( fieldName ); >+ } >+ >+ private boolean hasFieldRule( RuleInfo ruleInfo, ValidatorRule rule, LocaleSet localeSet ) >+ { >+ ValidatableField field = getField( ruleInfo, localeSet ); > if ( field == null ) { return false; } > > return field.hasRule( rule ); >@@ -144,8 +163,11 @@ > ruleInfo.getFieldDisplayName(), > ruleInfo.getFieldDisplayNameKey() ) ); > } >- >- field.addRule( rule ); >+ >+ // >+ // A field element without rules is OK, but we don't want to add a null rule. >+ // >+ if ( rule != null ) { field.addRule( rule ); } > } > > public void writeXml( PrintStream outputStream, File mergeFile ) >Index: netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatableField.java >=================================================================== >--- netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatableField.java (revision 47488) >+++ netui/src/compiler/org/apache/beehive/netui/compiler/model/validation/ValidatableField.java (working copy) >@@ -50,6 +50,8 @@ > > protected boolean hasRule( ValidatorRule rule ) > { >+ assert rule != null; >+ > String name = rule.getRuleName(); > for ( int i = 0; i < _rules.size(); i++ ) > { >@@ -63,6 +65,8 @@ > > public void addRule( ValidatorRule rule ) > { >+ assert rule != null; >+ > _rules.add( rule ); > } > >@@ -88,7 +92,11 @@ > { > assert fieldElement.getProperty().equals( _propertyName ); > >- if ( fieldElement.getDepends() == null ) fieldElement.setDepends( getDependsList() ); >+ if ( fieldElement.getDepends() == null ) { >+ String depends = getDependsList(); >+ >+ if ( depends != null && depends.length() > 0 ) { fieldElement.setDepends( depends ); } >+ } > > // > // Add the display name as the default first argument (can be overridden by individual rules). >@@ -124,11 +132,18 @@ > } > } > >- if ( defaultArg0Element == null ) defaultArg0Element = fieldElement.addNewArg0(); >- defaultArg0Element.setKey( displayName ); >- defaultArg0Element.setResource( Boolean.toString( displayNameIsResource ) ); >- >- >+ if ( defaultArg0Element == null && _rules.size() > 0 ) >+ { >+ defaultArg0Element = fieldElement.addNewArg0(); >+ } >+ >+ if ( defaultArg0Element != null ) >+ { >+ defaultArg0Element.setKey( displayName ); >+ defaultArg0Element.setResource( Boolean.toString( displayNameIsResource ) ); >+ } >+ >+ > // > // Go through the rules, and add each one. Each rule can spray into 1) an entry in the comma-separated > // rules dependencies list, 2) a set of elements, 3) a set of elements. > >