RE: Problem converting from Struts tags to JSTL

2003-08-27 Thread Karr, David
> -Original Message-
> From: Kevin A. Palfreyman [mailto:[EMAIL PROTECTED] 
> 
> Thanks for the pointer to the user guide, but unfortunately it doesn't
> help.
> 
> I tried:
> 
> 
> 
> And
> 
> 
> 
> And
> 
> 
> 
> But those didn't work either.
> 
> I think the problem is with the nested evaluation - combining the
> scriptlet and the EL.
> 
> Any other ideas?

First of all, if noone's mentioned this yet, the "taglibs-user" list is
a better place to discuss this.

I believe that the following will do what you want:

  

The similar expression of:

  

Doesn't do the same thing.

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



RE: Problem converting from Struts tags to JSTL

2003-08-27 Thread Hue Holleran
Ah good - glad it's sorted.

BTW, as a matter of interest - I tend to use DynaActionForm as a nested bean
in a DynaActionForm. This allows the properties of the Dyna to be defined in
struts-config (may not suit you of course, just thought I'd mention it in
case it's of use):

// Get reference to DynaActionForm passed to action
DynaActionForm dynaForm = (DynaActionForm) form;

// Get dafc - to create DynaActionForms
ModuleConfig mconfig = mapping.getModuleConfig();
FormBeanConfig fbconfig =
mconfig.findFormBeanConfig("Sub-DynaActionForm-name-defined-in-struts-config
");
DynaActionFormClass dafc =
DynaActionFormClass.createDynaActionFormClass(fbconfig);
DynaActionForm mySubForm = (DynaActionForm) dafc.newInstance();

...
// Populate Dyna etc.
...

// Nest Dyna in main form bean
form.set("subform",mySubForm);

BTW - glad to see it's sunny in Cambridge today!

Hue.


> -Original Message-
> From: Kevin A. Palfreyman [mailto:[EMAIL PROTECTED]
> Sent: 27 August 2003 13:37
> To: Struts Users Mailing List
> Subject: RE: Problem converting from Struts tags to JSTL
>
>
> Hi Hue - thanks for your efforts.
>
> I actually just managed to get it working as your mail arrived.
>
> Here is what I had to do:
> 1) Change the JSP to be
>   
>(actually just like you suggested)
>
> 2) This is the interesting bit - I had to subclass BasicDynaBean
>to expose a getMap() method.  This is what DynaActionForm
>does, and was discussed on the commons-dev list in Nov2002
>by Craig, David, and co.
>
>I then had to pass that new class as the 2nd param of the
>constructor of BasicDynaClass that creates the instance for me.
>
> Thanks again,
>
>   Kev
>
>
>
> > -Original Message-
> > From: Hue Holleran [mailto:[EMAIL PROTECTED]
> > Sent: 27 August 2003 13:20
> > To: Struts Users Mailing List
> > Subject: RE: Problem converting from Struts tags to JSTL
> >
> >
> > Hi Kev,
> >
> > Sorry - I missed the fieldName being dynamic bit(!). I think
> > you may want to consider moving to JSTL for the loop bit so
> > it will save having to do conversions but I think the
> > following will achieve what you're trying to do:
> >
> >   
> >> default="uh?" />
> >
> > BTW you could remove the default="uh?" bit - I use this for
> > testing so that I can at least see the loop working.
> >
> > I don't tend to mix EL with non-EL so this may not be the
> > optimum solution - someone else may have a better idea - as I
> > guess the performance will be slower and heavier due to
> > having to copy a value to a bean in page scope.
> >
> > Hue.
> >
> > > -Original Message-
> > > From: Kevin A. Palfreyman [mailto:[EMAIL PROTECTED]
> > > Sent: 27 August 2003 11:32
> > > To: Struts Users Mailing List
> > > Subject: RE: Problem converting from Struts tags to JSTL
> > >
> > >
> > > Thanks for the pointer to the user guide, but unfortunately
> > it doesn't
> > > help.
> > >
> > > I tried:
> > >
> > > 
> > >
> > > And
> > >
> > > 
> > >
> > > And
> > >
> > > 
> > >
> > > But those didn't work either.
> > >
> > > I think the problem is with the nested evaluation - combining the
> > > scriptlet and the EL.
> > >
> > > Any other ideas?
> > >
> > >   Kev
> > >
> > > > -Original Message-
> > > > From: Hue Holleran [mailto:[EMAIL PROTECTED]
> > > > Sent: 27 August 2003 10:21
> > > > To: Struts Users Mailing List
> > > > Subject: RE: Problem converting from Struts tags to JSTL
> > > >
> > > >
> > > > Try the User Guide:
> > > >
> > > >
> > > > http://jakarta.apache.org/struts/userGuide/building_controller
> > > > .html#dyna_act
> > > > ion_form_classes
> > > >
> > > > > -Original Message-
> > > > > From: Kevin A. Palfreyman [mailto:[EMAIL PROTECTED]
> > > > > Sent: 27 August 2003 10:05
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: Problem converting from Struts tags to JSTL
> > > > >
> > > > >
> > > > > Hello,
> > > > >
> > > > > I'm trying to convert some pages from Struts tags t

RE: Problem converting from Struts tags to JSTL

2003-08-27 Thread Kevin A. Palfreyman
Hi Hue - thanks for your efforts.

I actually just managed to get it working as your mail arrived.

Here is what I had to do:
1) Change the JSP to be

   (actually just like you suggested)

2) This is the interesting bit - I had to subclass BasicDynaBean
   to expose a getMap() method.  This is what DynaActionForm
   does, and was discussed on the commons-dev list in Nov2002
   by Craig, David, and co.

   I then had to pass that new class as the 2nd param of the 
   constructor of BasicDynaClass that creates the instance for me.

Thanks again,

Kev



> -Original Message-
> From: Hue Holleran [mailto:[EMAIL PROTECTED] 
> Sent: 27 August 2003 13:20
> To: Struts Users Mailing List
> Subject: RE: Problem converting from Struts tags to JSTL
> 
> 
> Hi Kev,
> 
> Sorry - I missed the fieldName being dynamic bit(!). I think 
> you may want to consider moving to JSTL for the loop bit so 
> it will save having to do conversions but I think the 
> following will achieve what you're trying to do:
> 
>   
>default="uh?" />
> 
> BTW you could remove the default="uh?" bit - I use this for 
> testing so that I can at least see the loop working.
> 
> I don't tend to mix EL with non-EL so this may not be the 
> optimum solution - someone else may have a better idea - as I 
> guess the performance will be slower and heavier due to 
> having to copy a value to a bean in page scope.
> 
> Hue.
> 
> > -Original Message-
> > From: Kevin A. Palfreyman [mailto:[EMAIL PROTECTED]
> > Sent: 27 August 2003 11:32
> > To: Struts Users Mailing List
> > Subject: RE: Problem converting from Struts tags to JSTL
> >
> >
> > Thanks for the pointer to the user guide, but unfortunately 
> it doesn't 
> > help.
> >
> > I tried:
> >
> > 
> >
> > And
> >
> > 
> >
> > And
> >
> > 
> >
> > But those didn't work either.
> >
> > I think the problem is with the nested evaluation - combining the 
> > scriptlet and the EL.
> >
> > Any other ideas?
> >
> > Kev
> >
> > > -Original Message-
> > > From: Hue Holleran [mailto:[EMAIL PROTECTED]
> > > Sent: 27 August 2003 10:21
> > > To: Struts Users Mailing List
> > > Subject: RE: Problem converting from Struts tags to JSTL
> > >
> > >
> > > Try the User Guide:
> > >
> > >
> > > http://jakarta.apache.org/struts/userGuide/building_controller
> > > .html#dyna_act
> > > ion_form_classes
> > >
> > > > -Original Message-
> > > > From: Kevin A. Palfreyman [mailto:[EMAIL PROTECTED]
> > > > Sent: 27 August 2003 10:05
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Problem converting from Struts tags to JSTL
> > > >
> > > >
> > > > 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:
> > > >
> > > > 
> > > >
> > > > 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?
> > > >
> > > >  > > />  > > > value="${instanceForm.dynamic.<%=fieldName%>}" />  > > > 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
> > > &

RE: Problem converting from Struts tags to JSTL

2003-08-27 Thread Hue Holleran
Hi Kev,

Sorry - I missed the fieldName being dynamic bit(!). I think you may want to
consider moving to JSTL for the loop bit so it will save having to do
conversions but I think the following will achieve what you're trying to do:

  
  

BTW you could remove the default="uh?" bit - I use this for testing so that
I can at least see the loop working.

I don't tend to mix EL with non-EL so this may not be the optimum solution -
someone else may have a better idea - as I guess the performance will be
slower and heavier due to having to copy a value to a bean in page scope.

Hue.

> -Original Message-
> From: Kevin A. Palfreyman [mailto:[EMAIL PROTECTED]
> Sent: 27 August 2003 11:32
> To: Struts Users Mailing List
> Subject: RE: Problem converting from Struts tags to JSTL
>
>
> Thanks for the pointer to the user guide, but unfortunately it doesn't
> help.
>
> I tried:
>
> 
>
> And
>
> 
>
> And
>
> 
>
> But those didn't work either.
>
> I think the problem is with the nested evaluation - combining the
> scriptlet and the EL.
>
> Any other ideas?
>
>   Kev
>
> > -Original Message-
> > From: Hue Holleran [mailto:[EMAIL PROTECTED]
> > Sent: 27 August 2003 10:21
> > To: Struts Users Mailing List
> > Subject: RE: Problem converting from Struts tags to JSTL
> >
> >
> > Try the User Guide:
> >
> >
> > http://jakarta.apache.org/struts/userGuide/building_controller
> > .html#dyna_act
> > ion_form_classes
> >
> > > -Original Message-
> > > From: Kevin A. Palfreyman [mailto:[EMAIL PROTECTED]
> > > Sent: 27 August 2003 10:05
> > > To: [EMAIL PROTECTED]
> > > Subject: Problem converting from Struts tags to JSTL
> > >
> > >
> > > 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:
> > >
> > > 
> > >
> > > 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?
> > >
> > >  > />  > > value="${instanceForm.dynamic.<%=fieldName%>}" />  > > 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
> > >
> > >
> > > ---
> > > Incoming mail is certified Virus Free.
> > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
> > >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003


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



RE: Problem converting from Struts tags to JSTL

2003-08-27 Thread Kevin A. Palfreyman
Thanks for the pointer to the user guide, but unfortunately it doesn't
help.

I tried:



And



And



But those didn't work either.

I think the problem is with the nested evaluation - combining the
scriptlet and the EL.

Any other ideas?

Kev

> -Original Message-
> From: Hue Holleran [mailto:[EMAIL PROTECTED] 
> Sent: 27 August 2003 10:21
> To: Struts Users Mailing List
> Subject: RE: Problem converting from Struts tags to JSTL
> 
> 
> Try the User Guide:
> 
> 
> http://jakarta.apache.org/struts/userGuide/building_controller
> .html#dyna_act
> ion_form_classes
> 
> > -Original Message-
> > From: Kevin A. Palfreyman [mailto:[EMAIL PROTECTED]
> > Sent: 27 August 2003 10:05
> > To: [EMAIL PROTECTED]
> > Subject: Problem converting from Struts tags to JSTL
> >
> >
> > 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:
> >
> > 
> >
> > 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?
> >
> >  />  > value="${instanceForm.dynamic.<%=fieldName%>}" />  > 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
> >
> >
> > ---
> > Incoming mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
> >
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

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



RE: Problem converting from Struts tags to JSTL

2003-08-27 Thread Hue Holleran
Try the User Guide:


http://jakarta.apache.org/struts/userGuide/building_controller.html#dyna_act
ion_form_classes

> -Original Message-
> From: Kevin A. Palfreyman [mailto:[EMAIL PROTECTED]
> Sent: 27 August 2003 10:05
> To: [EMAIL PROTECTED]
> Subject: Problem converting from Struts tags to JSTL
>
>
> 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:
>
> 
>
> 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?
>
> 
> 
> 
>
> 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
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003


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



Problem converting from Struts tags to JSTL

2003-08-27 Thread Kevin A. Palfreyman
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:



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?





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