You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@locus.apache.org on 2000/06/14 21:28:59 UTC
cvs commit: jakarta-struts/src/share/org/apache/struts/util BeanUtils.java
craigmcc 00/06/14 12:28:58
Modified: . build.bat
src/share/org/apache/struts/taglib ErrorsTag.java
src/share/org/apache/struts/util BeanUtils.java
Log:
Make BeanUtils.populate() work correctly with the "on" string that is sent
when you have a checked checkbox with no value clause.
Make the errors tag work with a Single string argument as well as a string
array.
Revision Changes Path
1.4 +2 -2 jakarta-struts/build.bat
Index: build.bat
===================================================================
RCS file: /home/cvs/jakarta-struts/build.bat,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- build.bat 2000/06/02 00:39:30 1.3
+++ build.bat 2000/06/14 19:28:53 1.4
@@ -1,4 +1,4 @@
-@echo off
+@echo off
rem ---------------------------------------------------------------------------
rem build.bat -- Build Script for the "Struts" Toolkit
rem
@@ -18,7 +18,7 @@
rem TOMCAT_HOME Distribution directory for "jakarta-tomcat".
rem [../jakarta-tomcat]
rem
-rem $Id: build.bat,v 1.3 2000/06/02 00:39:30 craigmcc Exp $
+rem $Id: build.bat,v 1.4 2000/06/14 19:28:53 craigmcc Exp $
rem ---------------------------------------------------------------------------
1.3 +16 -5 jakarta-struts/src/share/org/apache/struts/taglib/ErrorsTag.java
Index: ErrorsTag.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/ErrorsTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ErrorsTag.java 2000/06/01 21:06:27 1.2
+++ ErrorsTag.java 2000/06/14 19:28:55 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/ErrorsTag.java,v 1.2 2000/06/01 21:06:27 craigmcc Exp $
- * $Revision: 1.2 $
- * $Date: 2000/06/01 21:06:27 $
+ * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/ErrorsTag.java,v 1.3 2000/06/14 19:28:55 craigmcc Exp $
+ * $Revision: 1.3 $
+ * $Date: 2000/06/14 19:28:55 $
*
* ====================================================================
*
@@ -88,7 +88,7 @@
* </ul>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.2 $ $Date: 2000/06/01 21:06:27 $
+ * @version $Revision: 1.3 $ $Date: 2000/06/14 19:28:55 $
*/
public final class ErrorsTag extends TagSupport {
@@ -148,8 +148,19 @@
// Were any error messages specified?
String errors[] = null;
try {
- errors = (String[]) pageContext.getAttribute
+ Object value = pageContext.getAttribute
(name, PageContext.REQUEST_SCOPE);
+ if (value == null) {
+ errors = null;
+ } else if (value instanceof String) {
+ errors = new String[1];
+ errors[0] = (String) value;
+ } else if (value instanceof String[]) {
+ errors = (String[]) value;
+ } else {
+ errors = new String[1];
+ errors[0] = value.toString();
+ }
} catch (Exception e) {
errors = null;
}
1.2 +12 -10 jakarta-struts/src/share/org/apache/struts/util/BeanUtils.java
Index: BeanUtils.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/BeanUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BeanUtils.java 2000/05/31 22:28:11 1.1
+++ BeanUtils.java 2000/06/14 19:28:57 1.2
@@ -1,13 +1,13 @@
/*
- * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/BeanUtils.java,v 1.1 2000/05/31 22:28:11 craigmcc Exp $
- * $Revision: 1.1 $
- * $Date: 2000/05/31 22:28:11 $
+ * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/BeanUtils.java,v 1.2 2000/06/14 19:28:57 craigmcc Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/06/14 19:28:57 $
*
* ====================================================================
- *
+ *
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -15,7 +15,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * 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
@@ -23,15 +23,15 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
+ * any, must include the following acknowlegement:
+ * "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", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
+ * from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
@@ -57,7 +57,7 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
- */
+ */
package org.apache.struts.util;
@@ -75,7 +75,7 @@
* Utility methods for populating JavaBeans properties via reflection.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.1 $ $Date: 2000/05/31 22:28:11 $
+ * @version $Revision: 1.2 $ $Date: 2000/06/14 19:28:57 $
*/
public final class BeanUtils {
@@ -122,6 +122,8 @@
else if (value.equalsIgnoreCase("yes"))
return (new Boolean(true));
else if (value.equalsIgnoreCase("true"))
+ return (new Boolean(true));
+ else if (value.equalsIgnoreCase("on"))
return (new Boolean(true));
else
return (new Boolean(false));