Hello,
I'm trying to convert some pages from Struts tags to JSTL for the next
iteration of our product and I've hit a problem.
[Struts 1.1, Tomcat 4.1.24, Java 1.4.2, JSTL 1.0.3]
I need to be able to dynamically access nested fields of my form object.
The Form object (instanceForm) contains a DynaBean (dynamic) as one
of its fields. The fields of the DynaBean are what I'm trying to
access.
The name of the particular field within the DynaBean is stored in a
local variable (fieldName) that is been populated in a loop.
The following Struts tag works fine:
<bean:write name="instanceForm" property='<%= "dynamic."+fieldName %>'/>
I'm new to JSTL, and I've tried various forms similar to those below
without success. Is what I'm trying to do possible?
<c:out value='<%= "${instanceForm.dynamic."+fieldName %>}' />
<c:out value="${instanceForm.dynamic.<%=fieldName%>}" />
<c:out value="${instanceForm.dynamic.${fieldName}}" />
Anyone have any ideas? Or should I stick with the Struts tags for this?
Thanks in advance,
Kev
---
Dr. Kevin Palfreyman
Apama (UK) Ltd,
Cambridge, UK