struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mathew, Manoj" <>
Subject Is there a way to find an Object type? Please help
Date Fri, 26 Sep 2003 13:47:01 GMT

  I been using only String data types in my DynaAction form.But i had a requirement to use
multi select options and i have to declare a String[] for it. the issue is i have my own method
which maps the form element to the appropriate fields of my controller factory.there i have
some code like this
public final static Collection transformFieldMap(DynaActionForm form) {
DynaClass dynaClass = form.getDynaClass();
		DynaProperty[] props = dynaClass.getDynaProperties();
		for (int i = 0; i < props.length; i++) {
			Object propertyNameObj = props[i].getName();

try {
				String fieldValue = (String) form.get(propertyNameObj.toString());
}catch (Exception e) {
				if (e instanceof ClassCastException) {
					String[] temp = (String[]) form.get(propertyNameObj.toString());


I am assuming that i get this ClassCastException only when the form element is a String[].
 I am live with this for now as i am using only one String[]  and rest are just String type.Is
there anyway i can find whether the 'Object' is of type string[]  ??? I tried  with instance
of and it is not working..

Thank you

Mathew Manoj
Group Information Systems (H243)
* (515)362-0539

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message