RE: dynamic properties in jsp

2003-09-29 Thread Andrew Hill
Have a look at the nested stuff.
http://www.keyboardmonkey.com/next/index.jsp

-Original Message-
From: hari_s [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 30 September 2003 14:06
To: 'Struts Users Mailing List'
Subject: RE: dynamic properties in jsp


I think it will be simple if u handle it with JavaScript

-Original Message-
From: krishnamohan [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 30, 2003 11:35 AM
To: '[EMAIL PROTECTED]'
Subject: dynamic properties in jsp

Hi,

I am working on a page where the user will dynamically add new rows at
runtime and there is  no limit.   This will be on a button 'Add New
Option'.
So I do not know what properties to create at compile time.  If anybody
has
worked on this type of scenario in struts, pl. help me how to do this or
with some code. I am using struts1.1 and tomcat.

Thanks,
Krishna


-
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]


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



RE: dynamic properties in jsp

2003-09-29 Thread hari_s
I think it will be simple if u handle it with JavaScript

-Original Message-
From: krishnamohan [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 30, 2003 11:35 AM
To: '[EMAIL PROTECTED]'
Subject: dynamic properties in jsp

Hi,

I am working on a page where the user will dynamically add new rows at
runtime and there is  no limit.   This will be on a button 'Add New
Option'.
So I do not know what properties to create at compile time.  If anybody
has
worked on this type of scenario in struts, pl. help me how to do this or
with some code. I am using struts1.1 and tomcat.

Thanks,
Krishna


-
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: dynamic properties in jsp

2003-09-29 Thread Abhijeet Mahalkar
You have to handale this in JAvascript in which use document.createElement method to 
create the table row,td, and components and values of this u can access in dynaform ...


abhijeet 

- Original Message - 
From: "krishnamohan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 30, 2003 10:05 AM
Subject: dynamic properties in jsp


Hi,

I am working on a page where the user will dynamically add new rows at
runtime and there is  no limit.   This will be on a button 'Add New Option'.
So I do not know what properties to create at compile time.  If anybody has
worked on this type of scenario in struts, pl. help me how to do this or
with some code. I am using struts1.1 and tomcat.

Thanks,
Krishna


-
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: Dynamic Properties

2002-06-26 Thread Adrian Cunningham

Hi,

I have implemented your code below for dynamic forms and it works a
treat, I might even say it is a little more convenient than the actual
DynaActionForm as you don't have to declare any form properties in the
struts-config file.

Although I do have one question for you.  Have you managed to implement
this using the struts validator?  I would be quite keen on using the
struts validator for dynamic forms/properties with this particular
workaround.  

Regards,
Adrian Cunningham

PS.Out of curiousity what do you think of the workaround I came up
with?



"Bhattad, Nilesh " <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
> I'm also facing the same problem of Dynamic properties with Struts 
> 1.0/1.1 As a workaround, I created my own classes DynaForm and 
> DynaFormClass
> 
> I'm attaching a pseudo code of DynaForm and DynaFormClass
> 
> 
> 
> 
> // A Form class which is common for all JSP pages 
>  public class DynaForm extends DynaActionForm
> {
> DynaFormClass formClass = new DynaFormClass();
>   
> public Object get(String name) 
> {
> Object value = dynaValues.get(name);
> return (value);
> }
> 
> public void set(String name, Object value) 
> {
> dynaValues.put(name, value);
> }
> 
> public DynaClass getDynaClass() 
> {
> return (this.formClass);
> }
> }
> 
> 
> 
> 
> // As DynaActionForm needs a descriptor object attached to it, // this

> class implements DynaClass interface and always returns Object // as a

> property. 
> public class DynaFormClass implements DynaClass
> {
>   private static Class cls;
>   private static DynaProperty property;
>   
>   static
>   {
>   cls = new Object().getClass();
>   property = new DynaProperty(null, cls);
>   }
>   
>   public String getName()
>   {
>   return null;
>   }
>   
>   public DynaProperty getDynaProperty(String name)
>   {
>   return new DynaProperty(null, cls);
>   }
>   
>   public DynaProperty[] getDynaProperties()
>   {
>   return null;
>   }
>   
>   public DynaBean newInstance()
>   throws IllegalAccessException, InstantiationException
>   {
>   return new DynaForm();
>   }
> }
> 
> 
> //
> // struts-config.xml
> //
> 
>  type="com.onebeacon.struts.action.DynaForm">
> 
> 
> 
> type="com.onebeacon.struts.action.ActionHandler"
>name="test"
>scope="request">
>
>   
>   
> 
> 
> 
> Please let me know if someone has a better solution for using Dynamic 
> properties.
> 
> Thanks
> Nilesh
> 
> 
> -Original Message-
> From: Daniel Hinz [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 24, 2002 9:44 AM
> To: Struts Users Mailing List
> Subject: Dynamic Properties
> 
> Hi,
> 
> i posted a feature request on struts-dev on friday, which i'd like to 
> bring to this forum for dicsussion. Although this has already been 
> discussed in some threads, a satifactory conclusion has not been 
> reached (at least in my opinion). So here it goes:
> 
> A) Use Cases:
> 1) Develop a generic RDMBS Browser using Struts.
> 2) Develop a WebInterface for arbitrary XML editing.
> 
> B) Problems in Struts 1.0 and 1.1:
> For each property A the corresonding setA / getA methods are invoked 
> upon read/write. There's nothing wrong with that. However i must 
> deploy form fields that are unknown to me at compile-time. Thus i 
> cannot write a Bean with the appropriate methods.
> 
> C) Request for extending org.apache.struts.action.ActionForm:
> A simple solution would be to introduce methods with the following
> signature:
> public void setProperty(String propertyName, Object propertyValue) 
> public Object getProperty(String propertyName)
> 
> D) Workaround:
> None known to me. There's a class called DynaActionForm which allows 
> you to add a dynamic number of fields *in the struts-config.xml file*.

> This is not feasible since the properties are unknown at Servlet 
> Initialization time.
> 
> I'm quite new to Struts so please forgive me if i missed something 
> blatantly obvious.
> 
> Regards,
> 
> Daniel Hinz
> 
> --
> Daniel Hinz
> Software Engineer
> [EMAIL PROTECTED]
> 
> 
> --
> To unsubscribe, e-mail: 
> 
> For additional commands, e-mail: 
> 
> 
> --
> To unsubscribe, e-mail:

> For additional commands, e-mail: 
> 
> 


--

This e-mail is confidential and is intended for the named recipient only. If
you receive it in error please destroy the message and all copies. Kainos
Software Ltd. does not accept liability for damage sustained as a result of
malicious s

Re: Dynamic Properties

2002-06-24 Thread Adrian Cunningham

Hi,

I posted a message last week with a similar problem.  I basically have
several fields on a row in a table, each row containing the same fields
but the number of rows in the table is dynamic and is dependant on a
number of things that aren't defined at compile time.

Although I managed to figure out a workaround based on some other posts
in this group (although not ideal) of sorts and have got the dynamic
form (as described above) to work.

First I have defined a form bean (IterateForm) that contains a Vector
and a constructor capable of initialising it with a fixed number of
blank elements.  Each element is another bean (NameForm) which is
essentially a row in the HTML table containing the dynamic fields.

NameForm.java
-
public final class NameForm extends ActionForm
{
private String title;
private String forename;
private String surname;

public NameForm()
{
title = "";
forename = "";
surname = "";
}

// getters and setters

IterateForm.java
-
public final class IterateForm extends ActionForm
{
private java.util.Vector names;

// Constructor
public IterateForm(int iNumElements)
{
names = new java.util.Vector(iNumElements);

for(int i = 0; i < iNumElements; i++)
{
NameForm nameForm = new NameForm();

nameForm.setTitle("");
nameForm.setForename("");
nameForm.setSurname("");

names.add(nameForm);
}

this.numRows = Integer.toString(iNumElements);
}

public java.util.Vector getNames()
{
return names;
}

// Don't require setter.

My first JSP index.jsp allows you to specify the number of rows for the
dynamic form.

index.jsp
-



Dynamic Forms Using Struts





Dynamic Form Using Struts




Number of Rows: 








This page submits its form to the DynaSetupAction action class.  This
class then creates a IterateForm (above) using the constructor and
passing it the number of rows for the dynamic form, which initialises
the collection with whatever number of elements you want.

DynaSetupAction.java

public final class DynaSetupAction extends Action
{
public ActionForward perform(ActionMapping mapping,
 ActionForm form,
 HttpServletRequest
request,
 HttpServletResponse
response)
 throws IOException,
ServletException
{


int numRows =
Integer.parseInt(((DynaSetupForm)form).getNumRows());

HttpSession session = request.getSession();

// Create IterateForm with dynamic number of rows.
ActionForm iterForm = new IterateForm(numRows);

session.setAttribute("iterateForm", iterForm);
// request.setAttribute("iterateForm", iterForm);

return (mapping.findForward("iterationForm"));
}
}

This action then forwards control back to a JSP named IterateForm.jsp.
Which iterates around the collection creating rows the number of rows
specifid from the index.jsp page.

IterateForm.jsp
---



Dynamic Form Using Struts




Dynamic Form Using Struts



Title
Forename
Surname


 
  
  
  
 













This page then submits its results to the IterateAction action class
which simply forwards control to the results page DynaFormResults.jsp
which displays them. (See Below).

DynaFormResults.jsp
---



Dynamic Form Results Page






Results of Dynamic Form



First Person:







struts-config.xml
--
...
  
  
  
...


...



...


It isn't an ideal way to do it I suppose but it works for what I need.

Adrian Cunningham.



"Daniel Hinz" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
> Hi,
> 
> i posted a feature request on struts-dev on friday, which i'd like to 
> bring to this forum for dicsussion. Although this has already been 
> discussed in some threads, a satifactory conclusion has not been 
> reached (at least in my opinion). So here it goes:
> 
> A) Use Cases:
> 1) Develop a generic RDMBS Browser using Struts.
> 2) Develop a WebInterface for arbitrary XML editing.
> 
> B) Problems in Struts 1.0 and 1.1:
> For each property A the corresonding setA / getA methods are invoked 
> upon read/write. There's nothing wrong with that. However i must 
> deploy form fields that are unknown to me at compile-time. Thus i 
> cannot write a Bean with the appropriate methods.
> 
> C) Request for extending org.apache.struts.action.ActionForm:
> A simple solution would be to intr

RE: Dynamic Properties

2002-06-24 Thread Bhattad, Nilesh

I'm also facing the same problem of Dynamic properties with Struts 1.0/1.1
As a workaround, I created my own classes DynaForm and DynaFormClass

I'm attaching a pseudo code of DynaForm and DynaFormClass




// A Form class which is common for all JSP pages

public class DynaForm extends DynaActionForm 
{
DynaFormClass formClass = new DynaFormClass();

public Object get(String name) 
{
Object value = dynaValues.get(name);
return (value);
}

public void set(String name, Object value) 
{
dynaValues.put(name, value);
}

public DynaClass getDynaClass() 
{
return (this.formClass);
}
}




// As DynaActionForm needs a descriptor object attached to it,
// this class implements DynaClass interface and always returns Object 
// as a property.

public class DynaFormClass implements DynaClass
{
private static Class cls;
private static DynaProperty property;

static
{
cls = new Object().getClass();
property = new DynaProperty(null, cls);
}

public String getName()
{
return null;
}

public DynaProperty getDynaProperty(String name)
{
return new DynaProperty(null, cls);
}

public DynaProperty[] getDynaProperties()
{
return null;
}

public DynaBean newInstance()
throws IllegalAccessException, InstantiationException
{
return new DynaForm();
}
}


//
// struts-config.xml
//






   


  


Please let me know if someone has a better solution for using Dynamic
properties.

Thanks
Nilesh


-Original Message-
From: Daniel Hinz [mailto:[EMAIL PROTECTED]] 
Sent: Monday, June 24, 2002 9:44 AM
To: Struts Users Mailing List
Subject: Dynamic Properties

Hi,

i posted a feature request on struts-dev on friday, which i'd like to bring
to this forum for dicsussion. Although this has already been discussed in
some threads, a satifactory conclusion has not been reached (at least in my
opinion). So here it goes:

A) Use Cases:
1) Develop a generic RDMBS Browser using Struts.
2) Develop a WebInterface for arbitrary XML editing.

B) Problems in Struts 1.0 and 1.1:
For each property A the corresonding setA / getA methods are invoked upon
read/write. There's nothing wrong with that. However i must deploy form
fields that are unknown to me at compile-time. Thus i cannot write a Bean
with the appropriate methods.

C) Request for extending org.apache.struts.action.ActionForm:
A simple solution would be to introduce methods with the following
signature:
public void setProperty(String propertyName, Object propertyValue)
public Object getProperty(String propertyName)

D) Workaround:
None known to me. There's a class called DynaActionForm which allows you to
add a dynamic number of fields *in the struts-config.xml file*. This is not
feasible since the properties are unknown at Servlet Initialization time.

I'm quite new to Struts so please forgive me if i missed something blatantly
obvious.

Regards,

Daniel Hinz

--
Daniel Hinz
Software Engineer
[EMAIL PROTECTED]


--
To unsubscribe, e-mail:

For additional commands, e-mail:


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




Re: Dynamic Properties and Database

2002-02-18 Thread Bryan Field-Elliot

Take a look at my Simper package, which does basically this:

http://www.netmeme.org/simper

Still rough around the edges, but within a week or so, I hope to make a
polished project out of it (hosted at SourceForge). I've been saying
"within a week or so" for about a month now :( but will really try to
get to it soon. In the meantime it's downloadable and usable in it's
current form. Please read the README first, it explains what the whole
project is about.

Bryan


On Fri, 2002-02-15 at 04:11, Peter Pilgrim wrote:

HI

I have had a look Jan Sorenson's  Dynamic Properties contribution

http://husted.com/struts/resources/DynamicProperties.htm

How useful is this code for reading from and writing to arbitary database
tables. It sounds like I can map any database column name to
an action form property.

For example given the SQL table

create table COFFEE (
 coffee_id integer,
 coffee_namevarchar(null),
 coffee_descvarchar(null),
 . . . )

Mapped to action form accessor and mutator

 public int getCoffee_Id() ;
 public void  setCoffee_Id( int ) ;
 . . .

It looks a bit nasty especially the underscores but I think it could work.

Comments

--
Peter Pilgrim ++44 (0)207-545-9923

 Swamped under electionic mails


--

This e-mail may contain confidential and/or privileged information. If you are not 
the intended recipient (or have received this e-mail in error) please notify the 
sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.



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






Re: Dynamic properties in ActionForms with custom tag

2002-01-05 Thread Ted Husted

Mapped properties are supported in the nightly build. 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/



Freek Segers wrote:
> 
> Hello again,
> 
> I've partially solved my problem. I found the new commons-beanutils package
> that has new methods in PropertyUtils (getMappedProperty() and
> setmappedProperty()).
> 
> To solve my second problem I now hardcoded my form bean's name into the
> custom tag implementation to look it up in pageContext.
> 
> However, my struts release (version 1.0) doesn't populate the form bean when
> I submit the form. I the servlet log I do see that Struts looks up and
> recycles the form bean and it logs that it populates the form bean but the
> dynamic properties' setter method isn't called.
> 
> Do I need a new struts release that uses the common-beanutils package. If
> so, which build has support for this.
> 
> Thanks again,
> 
> Freek Segers
> 
> on 03-01-2002 08:51 you wrote:
> 
> > First, I've created a custom tag that creates different types of HTML form
> > fields.
> > The number of fields generated varies and the names of the fields are dynamic.
> > I can't figure out how to let Struts populate the ActionForm that's linked to
> > the Action that handles the form.
> > I thought I read somewhere that you can use some feature of the JavaBean specs
> > to tell Struts what method to call (maybe by using PropertyDescriptors?), but
> > I can't find anything about this.
> >
> > Second, I don't know how I can restore any previously submitted values when
> > the form is shown for a second time, for example in case of a validation
> > error. Do I have access to the ActionForm from a custom tag implementation
> > somehow? Or can I let the ActionForm set properties in my custom tag?
> > I've been looking at the source code for the Struts -tag but
> > found no clues to how Struts manages to make the last submitted item selected
> > when the form is redisplayed.
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

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




Re: Dynamic properties in ActionForms with custom tag

2002-01-05 Thread Ted Husted

Freek Segers wrote:
> 
> Hello,
> 
> I'm currently working on my first Struts application and I'm facing two problems.
> 
> First, I've created a custom tag that creates different types of HTML form fields.
> The number of fields generated varies and the names of the fields are dynamic.
> I can't figure out how to let Struts populate the ActionForm that's linked to the 
>Action that handles the form.
> I thought I read somewhere that you can use some feature of the JavaBean specs to 
>tell Struts what method to call (maybe by using PropertyDescriptors?), but I can't 
>find anything about this.

The controller uses reflection. If the ActionForm has a property that
matches the name of a parameter, it populates the property with the
parameter's value. 

There are also ways to use hashtables behind ActionForms. See 

http://jguru.com/forums/view.jsp?EID=567079



> Second, I don't know how I can restore any previously submitted values when the form 
>is shown for a second time, for example in case of a validation error. Do I have 
>access to the ActionForm from a custom tag implementation somehow? Or can I let the 
>ActionForm set properties in my custom tag?
> I've been looking at the source code for the Struts -tag but found no 
>clues to how Struts manages to make the last submitted item selected when the form is 
>redisplayed.
> When I use the following Stuts HTML
> 
>  
>  
>  
> 
> how does the select-tag know which ActionForm bean it should use to get the selected 
>item. I've recompiled the select-tag with some debugging output and put it in my own 
>taglib, but the I get the Exception I expected: there is no form bean under the 
>default name used in the select-tag in pageContext.

It looks at the Action specified by the enclosing html:form, and uses
whatever ActionForm is specified by that Action. Alternatively, you can
specify the name of the bean yourself. 


> I'm really at a loss and I hope you can help me with this.
> 
> Thanks in advance,
> 
> Freek Segers

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/

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




Re: Dynamic properties in ActionForms with custom tag

2002-01-03 Thread Freek Segers

Hello again,

I've partially solved my problem. I found the new commons-beanutils package
that has new methods in PropertyUtils (getMappedProperty() and
setmappedProperty()).

To solve my second problem I now hardcoded my form bean's name into the
custom tag implementation to look it up in pageContext.

However, my struts release (version 1.0) doesn't populate the form bean when
I submit the form. I the servlet log I do see that Struts looks up and
recycles the form bean and it logs that it populates the form bean but the
dynamic properties' setter method isn't called.

Do I need a new struts release that uses the common-beanutils package. If
so, which build has support for this.

Thanks again,

Freek Segers


on 03-01-2002 08:51 you wrote:

> First, I've created a custom tag that creates different types of HTML form
> fields.
> The number of fields generated varies and the names of the fields are dynamic.
> I can't figure out how to let Struts populate the ActionForm that's linked to
> the Action that handles the form.
> I thought I read somewhere that you can use some feature of the JavaBean specs
> to tell Struts what method to call (maybe by using PropertyDescriptors?), but
> I can't find anything about this.
> 
> Second, I don't know how I can restore any previously submitted values when
> the form is shown for a second time, for example in case of a validation
> error. Do I have access to the ActionForm from a custom tag implementation
> somehow? Or can I let the ActionForm set properties in my custom tag?
> I've been looking at the source code for the Struts -tag but
> found no clues to how Struts manages to make the last submitted item selected
> when the form is redisplayed.


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




RE: Dynamic properties

2001-02-21 Thread Kevin Wang



You 
basically need to add a Hashtable to ActionForm (or its subclass) to hold 
dynamic properties ; PropertyUtils provides set/get methods 
to set/get dynamic properties to the Hashtalbe; and BeanUtils makes usre 
such methods get called before throwing 
a "NoSuchMethodFoundException". I've got it working for simple property with 
12/07/00 nightly built. It should be easy (though time comsuming) 
to do the same for indexed/nested properties.
 
Kevin

  -Original Message-From: Craig R. McClanahan 
  [mailto:[EMAIL PROTECTED]]Sent: Wednesday, February 21, 
  2001 11:33 AMTo: [EMAIL PROTECTED]Subject: 
  Re: Dynamic propertiesAllan Schweitz wrote: 
  

Can anyone tell me if the forms struts 
supports dynamic properties? If so is there an example available on how this 
works?I have a html form that 
builds up dynamically creating a table with checkboxes, text input and 
selectboxes. But since this form is dynamically generated there is no form 
class that reflects the dynamically generated form and struts cannot handle 
it. If anyone knows how to 
solve this in struts please let me know. Thanks in advance, Allan Schweitz[EMAIL PROTECTED]Struts 
  1.0 does not support dynamic properties, but this is on the TODO list for 
  Stuts 1.1.  Given the number of questions about it, I expect it to be 
  fairly high in the priorities. 
  Craig   


Re: Dynamic properties

2001-02-21 Thread Nino Walker



We've modified PropertyUtils.set/getSimpleProperty() to recognize when
the bean is a java.util.Map, and to call .get()/.put() instead of using
introspection.  It's a very minor change, and I can post the source
if anyone is interested.
Nino
"Craig R. McClanahan" wrote:
Allan Schweitz wrote:

Can
anyone tell me if the forms struts supports dynamic properties? If so is
there an example available on how this works?I have a html form that builds
up dynamically creating a table with checkboxes, text input and selectboxes.
But since this form is dynamically generated there is no form class that
reflects the dynamically generated form and struts cannot handle it.
If anyone knows how to solve this in struts
please let me know. Thanks
in advance, Allan Schweitz[EMAIL PROTECTED]
Struts 1.0 does not support dynamic properties, but this is on the TODO
list for Stuts 1.1.  Given the number of questions about it, I expect
it to be fairly high in the priorities.
Craig
 

--
 <-- Nino Walker, Speech Applications Lead, http://www.xtime.com
-->
 




Re: Dynamic properties

2001-02-21 Thread Craig R. McClanahan



Allan Schweitz wrote:

Can
anyone tell me if the forms struts supports dynamic properties? If so is
there an example available on how this works?I
have a html form that builds up dynamically creating a table with checkboxes,
text input and selectboxes. But since this form is dynamically generated
there is no form class that reflects the dynamically generated form and
struts cannot handle it. If
anyone knows how to solve this in struts please let me know. Thanks
in advance, Allan Schweitz[EMAIL PROTECTED]
Struts 1.0 does not support dynamic properties, but this is on the TODO
list for Stuts 1.1.  Given the number of questions about it, I expect
it to be fairly high in the priorities.
Craig
 




RE: Dynamic properties

2001-01-29 Thread Kevin Wang

check out http://archive.covalent.net/jakarta/struts-user/2000/12/0481.xml
for my previous post on handling dynamic properties with Struts.
unfortunately, it is not working with the latest nightly builds as changes
are significant.

indexed/nested properties were not "dynamically" supported.

> -Original Message-
> From: Matthias Bauer [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 29, 2001 3:58 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Dynamic properties
> 
> 
> Hi there,
> 
> this is a very interesting question Bram raised and I would 
> very urgently need
> this feature in my current application, too. So I would 
> really like to know if
> this can be achieved with Struts. Does anybody know, how a 
> form bean could be
> dynamically equipped with properties, so it could be used for 
> multiple forms,
> not just a single one?
> 
> So what I am looking for are the following two things:
> 
> 1. The form bean which is associated to a struts form should 
> be instantiated by
> a factory which decides depending on a cgi parameter which 
> form bean to use.
> 
> 2. The form bean can contain indexed properties which are 
> accessed by methods
> which conform to the JavaBeans specification, e. g. setter(int index,
> PropertyType value).
> 
> If I am getting it right, there is currently no way to 
> accomplish this, because
> Struts only allows static mapping between the form elements' 
> names and the form
> bean elements' names. And you can only define a static 
> mapping from jsp forms to
> form beans in struts-config.xml.
> 
> I would be glad if I were wrong and it is relly an easy thing 
> to do something
> like that. So any suggestions would be very welcome.
> 
> Thanks,
> 
> --- Matthias
> 
> Matthias Bauer +++ [EMAIL PROTECTED] +++ LivingLogic AG +++ 
www.livinglogic.de


> bram wrote:
> 
> Hi,
> 
> Is there any way to dynamicly add properties to a bean?
> 
> The problem is that I have a recordset and want to use the colomn names as
a
> property (indexed) without writing a bean for every possible recordset so
I
> can use it with Struts.
> 
> Bram



Re: Dynamic properties

2001-01-29 Thread Matthias Bauer

Hi there,

this is a very interesting question Bram raised and I would very urgently need
this feature in my current application, too. So I would really like to know if
this can be achieved with Struts. Does anybody know, how a form bean could be
dynamically equipped with properties, so it could be used for multiple forms,
not just a single one?

So what I am looking for are the following two things:

1. The form bean which is associated to a struts form should be instantiated by
a factory which decides depending on a cgi parameter which form bean to use.

2. The form bean can contain indexed properties which are accessed by methods
which conform to the JavaBeans specification, e. g. setter(int index,
PropertyType value).

If I am getting it right, there is currently no way to accomplish this, because
Struts only allows static mapping between the form elements' names and the form
bean elements' names. And you can only define a static mapping from jsp forms to
form beans in struts-config.xml.

I would be glad if I were wrong and it is relly an easy thing to do something
like that. So any suggestions would be very welcome.

Thanks,

--- Matthias

Matthias Bauer +++ [EMAIL PROTECTED] +++ LivingLogic AG +++ www.livinglogic.de


> bram wrote:
> 
> Hi,
> 
> Is there any way to dynamicly add properties to a bean?
> 
> The problem is that I have a recordset and want to use the colomn names as a
> property (indexed) without writing a bean for every possible recordset so I
> can use it with Struts.
> 
> Bram