rleland 2003/09/23 20:42:03 Modified: src/validator/org/apache/struts/webapp/validator ApplicationResources.properties CityStateZip.java LocaleAction.java MultiRegistrationAction.java RegistrationAction.java RegistrationForm.java TypeAction.java TypeForm.java Added: src/validator/org/apache/struts/webapp/validator EditTypeAction.java Log: Bug#: 18993, and Bug#: 11520 Modify Validator example to show use of 'required' for checkboxes, radio,select-one, and select-multiple field types. Revision Changes Path 1.5 +16 -10 jakarta-struts/src/validator/org/apache/struts/webapp/validator/ApplicationResources.properties Index: ApplicationResources.properties =================================================================== RCS file: /home/cvs/jakarta-struts/src/validator/org/apache/struts/webapp/validator/ApplicationResources.properties,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ApplicationResources.properties 30 Aug 2003 03:40:56 -0000 1.4 +++ ApplicationResources.properties 24 Sep 2003 03:42:03 -0000 1.5 @@ -55,20 +55,26 @@ multiRegistrationForm.description=multi-page example with client side JavaScript validation and server side validation # Type form -typeForm.title=Type Form -typeForm.description=Example validating some primitive numbers, a range on the integer field, a date, and a credit card number. -typeForm.title.create=Type Form typeForm.byte.displayname=Byte Field -typeForm.short.displayname=Short Field -typeForm.integer.displayname=Integer Field -typeForm.long.displayname=Long Field +typeForm.checkbox.used.languages=Programming Languages used +typeForm.creditCard.displayname=Credit Card +typeForm.date.displayname=Date Field +typeForm.description=Example validating some primitive numbers, a range on the integer field, a date, and a credit card number. +typeForm.double.displayname=Double Field typeForm.float.displayname=Float Field typeForm.floatRange.displayname=Float Range Field -typeForm.double.displayname=Double Field -typeForm.date.displayname=Date Field -typeForm.creditCard.displayname=Credit Card -typeForm.nested=Nested Text +typeForm.integer.displayname=Integer Field +typeForm.long.displayname=Long Field typeForm.nested.name.displayname=Name +typeForm.nested=Nested Text +typeForm.option.os.list=Operating Systems in use +typeForm.option.satisfaction=Satisfaction +typeForm.option.select.many=<Select one or more> +typeForm.option.select.one=<Select One> +typeForm.radio.overall.satisfaction=Overall Satisfaction +typeForm.short.displayname=Short Field +typeForm.title.create=Type Form +typeForm.title=Type Form # JavaScript Type Form jsTypeForm.title=JavaScript Type Form 1.2 +10 -4 jakarta-struts/src/validator/org/apache/struts/webapp/validator/CityStateZip.java Index: CityStateZip.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/validator/org/apache/struts/webapp/validator/CityStateZip.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CityStateZip.java 19 Mar 2002 03:33:58 -0000 1.1 +++ CityStateZip.java 24 Sep 2003 03:42:03 -0000 1.2 @@ -1,7 +1,13 @@ /* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -17,7 +23,7 @@ * distribution. * * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: + * any, must include the following acknowledgement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, @@ -29,8 +35,8 @@ * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1.5 +10 -4 jakarta-struts/src/validator/org/apache/struts/webapp/validator/LocaleAction.java Index: LocaleAction.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/validator/org/apache/struts/webapp/validator/LocaleAction.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- LocaleAction.java 12 Nov 2002 03:56:09 -0000 1.4 +++ LocaleAction.java 24 Sep 2003 03:42:03 -0000 1.5 @@ -1,7 +1,13 @@ /* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -17,7 +23,7 @@ * distribution. * * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: + * any, must include the following acknowledgement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, @@ -29,8 +35,8 @@ * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1.7 +10 -4 jakarta-struts/src/validator/org/apache/struts/webapp/validator/MultiRegistrationAction.java Index: MultiRegistrationAction.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/validator/org/apache/struts/webapp/validator/MultiRegistrationAction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- MultiRegistrationAction.java 23 Aug 2003 17:06:13 -0000 1.6 +++ MultiRegistrationAction.java 24 Sep 2003 03:42:03 -0000 1.7 @@ -1,7 +1,13 @@ /* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2003 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -17,7 +23,7 @@ * distribution. * * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: + * any, must include the following acknowledgement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, @@ -29,8 +35,8 @@ * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1.5 +10 -4 jakarta-struts/src/validator/org/apache/struts/webapp/validator/RegistrationAction.java Index: RegistrationAction.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/validator/org/apache/struts/webapp/validator/RegistrationAction.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- RegistrationAction.java 16 Aug 2003 18:33:24 -0000 1.4 +++ RegistrationAction.java 24 Sep 2003 03:42:03 -0000 1.5 @@ -1,7 +1,13 @@ /* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2003 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -17,7 +23,7 @@ * distribution. * * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: + * any, must include the following acknowledgement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, @@ -29,8 +35,8 @@ * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1.2 +10 -4 jakarta-struts/src/validator/org/apache/struts/webapp/validator/RegistrationForm.java Index: RegistrationForm.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/validator/org/apache/struts/webapp/validator/RegistrationForm.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- RegistrationForm.java 19 Mar 2002 03:33:58 -0000 1.1 +++ RegistrationForm.java 24 Sep 2003 03:42:03 -0000 1.2 @@ -1,7 +1,13 @@ /* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -17,7 +23,7 @@ * distribution. * * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: + * any, must include the following acknowledgement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, @@ -29,8 +35,8 @@ * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1.5 +10 -4 jakarta-struts/src/validator/org/apache/struts/webapp/validator/TypeAction.java Index: TypeAction.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/validator/org/apache/struts/webapp/validator/TypeAction.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TypeAction.java 16 Aug 2003 18:33:24 -0000 1.4 +++ TypeAction.java 24 Sep 2003 03:42:03 -0000 1.5 @@ -1,7 +1,13 @@ /* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2003 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -17,7 +23,7 @@ * distribution. * * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: + * any, must include the following acknowledgement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, @@ -29,8 +35,8 @@ * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1.5 +63 -15 jakarta-struts/src/validator/org/apache/struts/webapp/validator/TypeForm.java Index: TypeForm.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/validator/org/apache/struts/webapp/validator/TypeForm.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TypeForm.java 11 Oct 2002 19:13:17 -0000 1.4 +++ TypeForm.java 24 Sep 2003 03:42:03 -0000 1.5 @@ -1,7 +1,13 @@ /* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -17,7 +23,7 @@ * distribution. * * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: + * any, must include the following acknowledgement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, @@ -29,8 +35,8 @@ * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -81,6 +87,10 @@ private String sDouble = null; private String sDate = null; private String sCreditCard = null; + private String sSatisfaction = null; + private String[] sOsList = null; + private String sOverallSatisfaction = null; + private String[] sUsedLanguages = null; private List lNames = initNames(); @@ -172,6 +182,38 @@ this.sCreditCard = sCreditCard; } + public String getSatisfaction() { + return sSatisfaction; + } + + public void setSatisfaction(String sSatisfaction) { + this.sSatisfaction = sSatisfaction; + } + + public String[] getOsList() { + return sOsList; + } + + public void setOsList(String[] anOsList) { + this.sOsList = anOsList; + } + + public String getOverallSatisfaction() { + return sOverallSatisfaction; + } + + public void setOverallSatisfaction(String anOverallSatisfaction) { + this.sOverallSatisfaction = anOverallSatisfaction; + } + + public String[] getUsedLanguages() { + return sUsedLanguages; + } + + public void setUsedLanguages(String[] anUsedLanguages) { + this.sUsedLanguages = anUsedLanguages; + } + public List getNameList() { return lNames; } @@ -187,17 +229,23 @@ * @param request The servlet request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { - action = null; - sByte = null; - sShort = null; - sInteger = null; - sLong = null; - sFloat = null; - sFloatRange = null; - sDouble = null; - sDate = null; - sCreditCard = null; - + String reset = (String)request.getAttribute("typeForm.reset"); + if ((null != reset)|| ("true".equals(reset))) { + action = null; + sByte = null; + sShort = null; + sInteger = null; + sLong = null; + sFloat = null; + sFloatRange = null; + sDouble = null; + sDate = null; + sCreditCard = null; + sSatisfaction = null; + sOsList = null; + sOverallSatisfaction = null; + sUsedLanguages = null; + } //lNames = initNames(); } 1.1 jakarta-struts/src/validator/org/apache/struts/webapp/validator/EditTypeAction.java Index: EditTypeAction.java =================================================================== /* * $Header: /home/cvs/jakarta-struts/src/validator/org/apache/struts/webapp/validator/EditTypeAction.java,v 1.1 2003/09/24 03:42:03 rleland Exp $ * $Revision: 1.1 $ * $Date: 2003/09/24 03:42:03 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowledgement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.struts.webapp.validator; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.util.ArrayList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.util.LabelValueBean; /** * Initializes ActionForm. * * @author Robert Leland */ public final class EditTypeAction extends Action { /** * Commons Logging instance. */ private Log log = LogFactory.getFactory().getInstance(this.getClass().getName()); /** * Process the specified HTTP request, and create the corresponding HTTP * response (or forward to another web component that will create it). * Return an <code>ActionForward</code> instance describing where and how * control should be forwarded, or <code>null</code> if the response has * already been completed. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @return Action to forward to * @exception Exception if an input/output error or servlet exception occurs */ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Was this transaction cancelled? initFormBeans(mapping, form, request); return mapping.findForward("success"); } /** * Convenience method for initializing form bean. * @param mapping The ActionMapping used to select this instance * @param request The HTTP request we are processing */ protected void initFormBeans( ActionMapping mapping, ActionForm form, HttpServletRequest request) { // Initialize ArrayList satisfactionList = new ArrayList(); satisfactionList.add(new LabelValueBean("Very Satisfied", "4")); satisfactionList.add(new LabelValueBean("Satisfied", "3")); satisfactionList.add(new LabelValueBean("Not Very Satisfied", "2")); satisfactionList.add(new LabelValueBean("Not Satisfied", "1")); request.setAttribute("satisfactionList", satisfactionList); ArrayList osTypes = new ArrayList(); osTypes.add(new LabelValueBean("Mac OsX", "OsX")); osTypes.add(new LabelValueBean("Windows 95/98/Me", "Win32")); osTypes.add(new LabelValueBean("Windows NT/2000/XP/2003", "WinNT")); osTypes.add(new LabelValueBean("Linux", "Linux")); osTypes.add(new LabelValueBean("BSD NetBSD/FreeBSD/OpenBSD", "BSD")); request.setAttribute("osTypes", osTypes); ArrayList languageTypes = new ArrayList(); languageTypes.add(new LabelValueBean("C++", "C++")); languageTypes.add(new LabelValueBean("C#", "C#")); languageTypes.add(new LabelValueBean("Java", "java")); languageTypes.add(new LabelValueBean("Smalltalk", "Smalltalk")); request.setAttribute("languageTypes", languageTypes); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]