You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mon Cab <fu...@yahoo.com> on 2005/12/01 04:31:45 UTC

Accessing an array from within a JSP

I am trying to define a string array as a property of
DynaValidatorForm in my struts config file and then
access that array from within a JSP but am getting an
incompatible types error when trying to do this.   My
form bean definition is as follows:

<form-bean name="myDynaActionForm"
type="org.apache.struts.validator.DynaValidatorForm">
	<form-property  	name="string_array"
type="java.lang.String[]"/>
</form-bean>

In my JSP (MyJSP.jsp) I wrote:

<bean:define id="string_array" name="myDynaActionForm"
property="string_array"/>
<%@ include file="Nested.jsp" %>

And then in my Nested.jsp I tried to access the array
as follows:

Object [] stringArray = string_array;

When I try load the page I get the following error
(written to stdout.log):

An error occurred at line: 6 in the jsp file:
/Nested.jsp
Generated servlet error:

C:\Program Files\Apache Software Foundation\Tomcat
5.0\work\Catalina\localhost\webapp\org\apache\jsp\MyJSP_jsp.java:211:
incompatible types
found   : java.lang.Object
required: java.lang.Object[]
Object [] stringArray = string_array;
      
Am I doing this wrong? If so, how should I be doing
this?




	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org