dgraham 2003/08/16 11:54:03
Modified: src/share/org/apache/struts/action DynaActionForm.java
Log:
Added getString() and getStrings() methods to make it easier to retrieve
String and String[] properties from the form.
Revision Changes Path
1.9 +39 -7
jakarta-struts/src/share/org/apache/struts/action/DynaActionForm.java
Index: DynaActionForm.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/DynaActionForm.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DynaActionForm.java 10 Apr 2003 02:35:28 -0000 1.8
+++ DynaActionForm.java 16 Aug 2003 18:54:03 -0000 1.9
@@ -59,17 +59,17 @@
*
*/
-
package org.apache.struts.action;
-
import java.lang.reflect.Array;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
+
import org.apache.commons.beanutils.ConversionException;
import org.apache.commons.beanutils.DynaBean;
import org.apache.commons.beanutils.DynaClass;
@@ -94,7 +94,6 @@
* @version $Revision$ $Date$
* @since Struts 1.1
*/
-
public class DynaActionForm extends ActionForm implements DynaBean {
@@ -330,7 +329,40 @@
}
}
+
+ /**
+ * Return the value of a String property with the specified name.
+ * This is equivalent to calling <code>(String) dynaForm.get(name)</code>.
+ *
+ * @param name Name of the property whose value is to be retrieved
+ *
+ * @throws IllegalArgumentException if there is no property
+ * of the specified name
+ * @throws NullPointerException if the type specified for the
+ * property is invalid
+ * @throws ClassCastException if the property is not a String.
+ * @since Struts 1.2
+ */
+ public String getString(String name) {
+ return (String) this.get(name);
+ }
+ /**
+ * Return the value of a String[] property with the specified name.
+ * This is equivalent to calling <code>(String[]) dynaForm.get(name)</code>.
+ *
+ * @param name Name of the property whose value is to be retrieved
+ *
+ * @throws IllegalArgumentException if there is no property
+ * of the specified name
+ * @throws NullPointerException if the type specified for the
+ * property is invalid
+ * @throws ClassCastException if the property is not a String[].
+ * @since Struts 1.2
+ */
+ public String[] getStrings(String name) {
+ return (String[]) this.get(name);
+ }
/**
* Return the <code>DynaClass</code> instance that describes the set of
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]