Mon Cab wrote:
Sorry. The formatting was messed up on my first post.  Hopefully this
is better

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 frorm 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:\Tomcat Home\MyJSP_jsp.java:211: incompatible types
found   : java.lang.Object
required: java.lang.Object[]
Object [] stringArray = string_array;
Am I doing this wrong? How should I be doing this?

Did you try specifying the 'type' attribute in your bean:define tag? Not sure if that's the problem, but it might help. Or, perhaps, an explicit cast on the assignment in your scriptlet code.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to