Re: How to handle multiploe unknown form fields

2004-09-30 Thread Frank W. Zammetti
Thank you Niall.  I'll be sure to have a look in a little while. 
Although I worked out a solution I can live with, it does feel like a 
tad more than it should be.  Thanks again!

Niall Pemberton wrote:
Rather than answer you here, I've set up a wiki page showing three different
options for "lazy list" type behaviour
  http://wiki.apache.org/struts/StrutsCatalogLazyList
I understand you wanting to only use "released" stuff - actually if you look
at LazyValidatorForm, theres not much too it - most of what it uses is
either already in Struts (it extends BeanValidatorForm) and Commons
BeanUtils (LazyDynaBean) - creating your own lazy ActionForm wouldn't take
much. In fact you can even use a LazyDynaBean directly in the
struts-config.xml as your ActionForm in Struts 1.2.4
Niall
- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 30, 2004 6:54 PM
Subject: Re: How to handle multiploe unknown form fields


I understand the JSP side of this eqation as you wrote it, although I
should have said I was looking for a solution that doesn't use Struts
taglibs because I try to avoid them at all costs, but that aside...
I'm still unclear however on what the ActionForm does... Using this
concept, do I HAVE to use the LazyActionForm you wrote?  I'd prefer to only
use things that are built-in to Struts, and unless I'm missing it in the
docs, that's not.
The question I'm getting at is that, like I said, the JSP code you wrote
makes sense, but what will put the submitted parameters into the collection
in the ActionForm when the submission happens?  That's the part I don't see.
Thanks for your help!
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Thu, September 30, 2004 1:51 pm, Niall Pemberton said:
You simply need a property in your ActionForm that returns a collection
of
"skill" beans and used the "indexed" attribute on the  tags. The
"isssue" that most people have problems with is when using a "Request"
scope
ActionForm you need to populate your collection with the right number of
skill beans - the way to handle this is some kind of "lazy list"
processing
for that property. Search the archives on indexed properties and lazy
list
processing.
In your jsp...

  
  
   Low
   Medium
   High
  

The trick is to name the "id" attribute to the same as the property in
the
form which returns the collection, that way Struts will generate
something
like:

The lazy ActionForms I wrote have the lazy list behaviour built in
http://www.niallp.pwp.blueyonder.co.uk/#lazydynabean
Niall
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 30, 2004 6:19 PM
Subject: How to handle multiploe unknown form fields

I have an interesting situation, one that has never come up before, and
I'm unsure how to deal with it...
Imagine you have some records from a database representing various
skills
(i.e., HTML, Javascript, J2EE, etc.).  Each has a SkillID associated
with
it.
You create a JSP that lists each skill with a drop-down next to it.
The
drop-down allows the user to select their skill level for each skill.
When the user hits Save, you need to update all the skills for that
user.
That's the scenario.  Here's the question... Each drop-down is given
the
name of the SkllID.  But how do you write an ActionForm for that?
Since the database can be expanded to include new skills at any time,
it's
impractical to add getters and setters for each SkillID, and in fact
breaks
low coupling goals anyway.
Is there a standard way of accepting what kind of amounts to an array
of
inputs from a form and getting it into an ActionForm in some way (maybe
as
an ArrayList or something?).
TIA!

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


--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to handle multiploe unknown form fields

2004-09-30 Thread Niall Pemberton
Rather than answer you here, I've set up a wiki page showing three different
options for "lazy list" type behaviour

  http://wiki.apache.org/struts/StrutsCatalogLazyList

I understand you wanting to only use "released" stuff - actually if you look
at LazyValidatorForm, theres not much too it - most of what it uses is
either already in Struts (it extends BeanValidatorForm) and Commons
BeanUtils (LazyDynaBean) - creating your own lazy ActionForm wouldn't take
much. In fact you can even use a LazyDynaBean directly in the
struts-config.xml as your ActionForm in Struts 1.2.4


Niall


- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 30, 2004 6:54 PM
Subject: Re: How to handle multiploe unknown form fields


> I understand the JSP side of this eqation as you wrote it, although I
should have said I was looking for a solution that doesn't use Struts
taglibs because I try to avoid them at all costs, but that aside...
>
> I'm still unclear however on what the ActionForm does... Using this
concept, do I HAVE to use the LazyActionForm you wrote?  I'd prefer to only
use things that are built-in to Struts, and unless I'm missing it in the
docs, that's not.
>
> The question I'm getting at is that, like I said, the JSP code you wrote
makes sense, but what will put the submitted parameters into the collection
in the ActionForm when the submission happens?  That's the part I don't see.
Thanks for your help!
>
> -- 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
>
> On Thu, September 30, 2004 1:51 pm, Niall Pemberton said:
> > You simply need a property in your ActionForm that returns a collection
of
> > "skill" beans and used the "indexed" attribute on the  tags. The
> > "isssue" that most people have problems with is when using a "Request"
> > scope
> > ActionForm you need to populate your collection with the right number of
> > skill beans - the way to handle this is some kind of "lazy list"
> > processing
> > for that property. Search the archives on indexed properties and lazy
list
> > processing.
> >
> > In your jsp...
> >
> > 
> >
> >
> > Low
> > Medium
> > High
> >
> > 
> >
> > The trick is to name the "id" attribute to the same as the property in
the
> > form which returns the collection, that way Struts will generate
something
> > like:
> >
> >  
> >
> >
> > The lazy ActionForms I wrote have the lazy list behaviour built in
> >
> > http://www.niallp.pwp.blueyonder.co.uk/#lazydynabean
> >
> > Niall
> >
> >
> > - Original Message -
> > From: <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, September 30, 2004 6:19 PM
> > Subject: How to handle multiploe unknown form fields
> >
> >
> >> I have an interesting situation, one that has never come up before, and
> > I'm unsure how to deal with it...
> >>
> >> Imagine you have some records from a database representing various
> >> skills
> > (i.e., HTML, Javascript, J2EE, etc.).  Each has a SkillID associated
with
> > it.
> >>
> >> You create a JSP that lists each skill with a drop-down next to it.
The
> > drop-down allows the user to select their skill level for each skill.
> >>
> >> When the user hits Save, you need to update all the skills for that
> >> user.
> >>
> >> That's the scenario.  Here's the question... Each drop-down is given
the
> > name of the SkllID.  But how do you write an ActionForm for that?
> >>
> >> Since the database can be expanded to include new skills at any time,
> >> it's
> > impractical to add getters and setters for each SkillID, and in fact
> > breaks
> > low coupling goals anyway.
> >>
> >> Is there a standard way of accepting what kind of amounts to an array
of
> > inputs from a form and getting it into an ActionForm in some way (maybe
as
> > an ArrayList or something?).
> >>
> >> TIA!
> >
> >
> >
> > -
> > 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: How to handle multiploe unknown form fields

2004-09-30 Thread David Suarez
I didn't realize that Struts could actually pass a pre-filled ArrayList.
That's pretty cool.The way that I've done index properties in Struts
call this method in my version:

Myproperty(int index, String value);

In that method, you can recreate whatever you want however you prefer.
This is a good reference for you to use -->
http://struts.apache.org/faqs/indexedprops.html

You also can use regular struts html tags to create the indexed values
for you by using the indexed=true property instead of hand-writing out
the name values as in the example below.  I use indexed properties to
recreate lists as well as objects in lists by tricking struts into doing
the right thing so the below will work.  It may just be that I have not
explained it clearly if it doesn't work for you.

Hope it helps you.

Regards...djsuarez

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 30, 2004 2:35 PM
To: [EMAIL PROTECTED]
Subject: Re: How to handle multiploe unknown form fields

In fact it did help because it answered some question for me.  I spent
the last hour searching for the RIGHT answer... This looked like it, but
for whatever reason it would never work for me when I tried to do the
exact same thing in my own project.  So, I went ahead and hacked
together my own solution...

In my test JSP, I have the following:


  
  
  
  


Then in my ActionForm, I have:

private ArrayList skills = new ArrayList();
public ArrayList getSkills() {
  this.skills.add(new String(""));
  return this.skills;
}
public void setSkills(ArrayList skills) {
  this.skills = skills;
}
public ArrayList getSkillsClean() {
  for (Iterator it = this.skills.iterator(); it.hasNext();) {
String s = (String)it.next();
if (s.trim().equalsIgnoreCase("")) {
  it.remove();
}
  }
  return this.skills;
}

Struts knows that it's an indexed property and knows how to populate the
ActionForm.  The problem I found is that you either have to (a) have an
initial capacity for the ArrayList and more importantly you must
initialize all the elements because the getSkills() method is called for
each element that is added.  So, instead, I add an element in
getSkills() myself.  The problem is, if you then later call getSkills()
from the Action, as one would expect to do, you'll always have an empty
element at the end (or more, if you happen to call the method more than
once).  No big deal, but I decided I didn't like it, so I added the
getSkillsClean() method, which removes the empty elements.

I don't think I'm doing this the right way, and indeed the link you sent
shows a more elegant solution, but as I said it wouldn't work for me
when I tried, and I like things that work (I'm odd that way!), and this
has that virtue, so I'm happy.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Thu, September 30, 2004 2:01 pm, [EMAIL PROTECTED] said:
> 
> 
> 
> 
> 
> Frank,
> 
> Will this help?  http://www.reumann.net/struts/nested.do
> 
> You didn't say anything about JSTL.  Just today I'm working on
populating
> a
> checkbox field in an object that's contained in a list.  Oops.  I just
> remembered I'm using html-el too.  I haven't tried it with with plain
> html.
> This is getting it done tho'.
> 
> c:forEach items="${workQueueForm.workQueueList}" var="workQueue"
> varStatus=
> "status">
> 
>tr >
>   td class="Data_AlignMiddle">
> html-el:checkbox property=
> "workQueueList[${status.index}].checked" />
> 
>   /td>
> 
> btw - how do you guys get code in your email w/o it messing up the
> archives?
> 
> 
> 
> 
> 
> 
>  [EMAIL PROTECTED]
>  om
>
To
>  09/30/2004 01:54  [EMAIL PROTECTED]
>  PM
cc
> 
>
Subject
>  Please respond to Re: How to handle multiploe
unknown
>"Struts Users   form fields
>Mailing List"
>  <[EMAIL PROTECTED]
>   he.org>
> 
> 
> 
> 
> 
> 
> 
> I understand the JSP side of this eqation as you wrote it, although I
> should have said I was looking for a solution that doesn't use Struts
> taglibs because I try to avoid them at all costs, but that aside...
> 
> I'm still unclear however on what the ActionForm does... Using this
> concept, do I HAVE to use the LazyActionForm you wrote?  I'd prefer to
> only
> use things that are built-in to Struts, and unless I'm missing it in
the
> docs, that's not.
> 
> The question I'

Re: How to handle multiploe unknown form fields

2004-09-30 Thread fzlists
r of
>> skill beans - the way to handle this is some kind of "lazy list"
>> processing
>> for that property. Search the archives on indexed properties and lazy
> list
>> processing.
>>
>> In your jsp...
>>
>> 
>>
>>    
>> Low
>> Medium
>> High
>>
>> 
>>
>> The trick is to name the "id" attribute to the same as the property in
> the
>> form which returns the collection, that way Struts will generate
> something
>> like:
>>
>>  
>>
>>
>> The lazy ActionForms I wrote have the lazy list behaviour built in
>>
>> http://www.niallp.pwp.blueyonder.co.uk/#lazydynabean
>>
>> Niall
>>
>>
>> - Original Message -
>> From: <[EMAIL PROTECTED]>
>> To: <[EMAIL PROTECTED]>
>> Sent: Thursday, September 30, 2004 6:19 PM
>> Subject: How to handle multiploe unknown form fields
>>
>>
>>> I have an interesting situation, one that has never come up before, and
>> I'm unsure how to deal with it...
>>>
>>> Imagine you have some records from a database representing various
>>> skills
>> (i.e., HTML, Javascript, J2EE, etc.).  Each has a SkillID associated
>> with
>> it.
>>>
>>> You create a JSP that lists each skill with a drop-down next to it. 
>>> The
>> drop-down allows the user to select their skill level for each skill.
>>>
>>> When the user hits Save, you need to update all the skills for that
>>> user.
>>>
>>> That's the scenario.  Here's the question... Each drop-down is given
>>> the
>> name of the SkllID.  But how do you write an ActionForm for that?
>>>
>>> Since the database can be expanded to include new skills at any time,
>>> it's
>> impractical to add getters and setters for each SkillID, and in fact
>> breaks
>> low coupling goals anyway.
>>>
>>> Is there a standard way of accepting what kind of amounts to an array
>>> of
>> inputs from a form and getting it into an ActionForm in some way (maybe
> as
>> an ArrayList or something?).
>>>
>>> TIA!
>>
>>
>>
>> -
>> 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]
> 
> 

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

Re: How to handle multiploe unknown form fields

2004-09-30 Thread bmf5





Frank,

Will this help?  http://www.reumann.net/struts/nested.do

You didn't say anything about JSTL.  Just today I'm working on populating a
checkbox field in an object that's contained in a list.  Oops.  I just
remembered I'm using html-el too.  I haven't tried it with with plain html.
This is getting it done tho'.

c:forEach items="${workQueueForm.workQueueList}" var="workQueue" varStatus=
"status">

   tr >
  td class="Data_AlignMiddle">
html-el:checkbox property=
"workQueueList[${status.index}].checked" />

  /td>

btw - how do you guys get code in your email w/o it messing up the
archives?





   
 [EMAIL PROTECTED] 
 om
To 
 09/30/2004 01:54  [EMAIL PROTECTED]  
 PM cc 
   
   Subject 
 Please respond to Re: How to handle multiploe unknown 
   "Struts Users   form fields 
   Mailing List"   
 <[EMAIL PROTECTED] 
  he.org>  
   
   
   




I understand the JSP side of this eqation as you wrote it, although I
should have said I was looking for a solution that doesn't use Struts
taglibs because I try to avoid them at all costs, but that aside...

I'm still unclear however on what the ActionForm does... Using this
concept, do I HAVE to use the LazyActionForm you wrote?  I'd prefer to only
use things that are built-in to Struts, and unless I'm missing it in the
docs, that's not.

The question I'm getting at is that, like I said, the JSP code you wrote
makes sense, but what will put the submitted parameters into the collection
in the ActionForm when the submission happens?  That's the part I don't
see.  Thanks for your help!

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Thu, September 30, 2004 1:51 pm, Niall Pemberton said:
> You simply need a property in your ActionForm that returns a collection
of
> "skill" beans and used the "indexed" attribute on the  tags. The
> "isssue" that most people have problems with is when using a "Request"
> scope
> ActionForm you need to populate your collection with the right number of
> skill beans - the way to handle this is some kind of "lazy list"
> processing
> for that property. Search the archives on indexed properties and lazy
list
> processing.
>
> In your jsp...
>
> 
>
>
> Low
> Medium
> High
>
> 
>
> The trick is to name the "id" attribute to the same as the property in
the
> form which returns the collection, that way Struts will generate
something
> like:
>
>  
>
>
> The lazy ActionForms I wrote have the lazy list behaviour built in
>
> http://www.niallp.pwp.blueyonder.co.uk/#lazydynabean
>
> Niall
>
>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, September 30, 2004 6:19 PM
> Subject: How to handle multiploe unknown form fields
>
>
>> I have an interesting situation, one that has never come up before, and
> I'm unsure how to deal with it...
>>
>> Imagine you have some records from a database representing various
>> skills
> (i.e., HTML, Javascript, J2EE, etc.).  Each has a SkillID associated with
> it.
>>
>> You create a JSP that lists each skill with a drop-down next to it.  The
> drop-down allows the user to select their skill level for each skill.
>>
>> When the user hits Save, you need to update all the skills for that
>> user.
>>
>> That's the scenario.  Here's the question... Each drop-down is given the
> name of the SkllID.  But how do you write an ActionForm for that?
>>
>> Since the database can be expanded to include new skill

Re: How to handle multiploe unknown form fields

2004-09-30 Thread fzlists
That will take care of the presentation side, true enough.  But the problem I'm still 
trying to solve is how to deal with all the parameters when the form submission 
happens.

For instance, let's say I dynamically construct names for each drop-down along the 
lines of "dropdown" where  is the skillID from the database... Since the 
number of skills could vary, it's not practical to have a getter/setter pair for each. 
 So, logically, I'd want to use a collection, maybe an ArrayList for instance.  
However, somewhere along the line, some code has to realize "gee, all of these 
parameters that were submitted are related in a sense and need to be stuffed into this 
ArrayList over here".  So, what will do that?  Is there anything in Struts to do it 
now?  If not, where do I need to write the code to do this?

That's really the crux of my problem.  Another posted mentioend the taglibs can 
construct such a name on the JSP side, and that's cool (except that I scorn the use of 
taglibs, but I could probably bring myself to do so here).  That still, as far as I 
can see, doesn't answer how this variable list of parameters gets put into the 
ActionForm.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Thu, September 30, 2004 1:38 pm, Bill Siggelkow said:
> Frank,
> 
> Couldn't you create your  elements within ?
> You would need to dynamically generate the name attribute using an a
> RTEXPR (or using html-el tags).
> 
> Also, LazyActionForm might help here ...
> 
> [EMAIL PROTECTED] wrote:
>> I have an interesting situation, one that has never come up before, and
>> I'm unsure how to deal with it...
>>
>> Imagine you have some records from a database representing various
>> skills (i.e., HTML, Javascript, J2EE, etc.).  Each has a SkillID
>> associated with it.
>>
>> You create a JSP that lists each skill with a drop-down next to it.  The
>> drop-down allows the user to select their skill level for each skill.
>>
>> When the user hits Save, you need to update all the skills for that
>> user.
>>
>> That's the scenario.  Here's the question... Each drop-down is given the
>> name of the SkllID.  But how do you write an ActionForm for that?
>>
>> Since the database can be expanded to include new skills at any time,
>> it's impractical to add getters and setters for each SkillID, and in
>> fact breaks low coupling goals anyway.
>>
>> Is there a standard way of accepting what kind of amounts to an array of
>> inputs from a form and getting it into an ActionForm in some way (maybe
>> as an ArrayList or something?).
>>
>> TIA!
>>
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>>
>>
>> 
>>
>> -
>> 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: How to handle multiploe unknown form fields

2004-09-30 Thread fzlists
I understand the JSP side of this eqation as you wrote it, although I should have said 
I was looking for a solution that doesn't use Struts taglibs because I try to avoid 
them at all costs, but that aside...

I'm still unclear however on what the ActionForm does... Using this concept, do I HAVE 
to use the LazyActionForm you wrote?  I'd prefer to only use things that are built-in 
to Struts, and unless I'm missing it in the docs, that's not.

The question I'm getting at is that, like I said, the JSP code you wrote makes sense, 
but what will put the submitted parameters into the collection in the ActionForm when 
the submission happens?  That's the part I don't see.  Thanks for your help!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Thu, September 30, 2004 1:51 pm, Niall Pemberton said:
> You simply need a property in your ActionForm that returns a collection of
> "skill" beans and used the "indexed" attribute on the  tags. The
> "isssue" that most people have problems with is when using a "Request"
> scope
> ActionForm you need to populate your collection with the right number of
> skill beans - the way to handle this is some kind of "lazy list"
> processing
> for that property. Search the archives on indexed properties and lazy list
> processing.
> 
> In your jsp...
> 
> 
>
>
> Low
> Medium
> High
>
> 
> 
> The trick is to name the "id" attribute to the same as the property in the
> form which returns the collection, that way Struts will generate something
> like:
> 
>  
> 
> 
> The lazy ActionForms I wrote have the lazy list behaviour built in
> 
> http://www.niallp.pwp.blueyonder.co.uk/#lazydynabean
> 
> Niall
> 
> 
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, September 30, 2004 6:19 PM
> Subject: How to handle multiploe unknown form fields
> 
> 
>> I have an interesting situation, one that has never come up before, and
> I'm unsure how to deal with it...
>>
>> Imagine you have some records from a database representing various
>> skills
> (i.e., HTML, Javascript, J2EE, etc.).  Each has a SkillID associated with
> it.
>>
>> You create a JSP that lists each skill with a drop-down next to it.  The
> drop-down allows the user to select their skill level for each skill.
>>
>> When the user hits Save, you need to update all the skills for that
>> user.
>>
>> That's the scenario.  Here's the question... Each drop-down is given the
> name of the SkllID.  But how do you write an ActionForm for that?
>>
>> Since the database can be expanded to include new skills at any time,
>> it's
> impractical to add getters and setters for each SkillID, and in fact
> breaks
> low coupling goals anyway.
>>
>> Is there a standard way of accepting what kind of amounts to an array of
> inputs from a form and getting it into an ActionForm in some way (maybe as
> an ArrayList or something?).
>>
>> TIA!
> 
> 
> 
> -
> 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: How to handle multiploe unknown form fields

2004-09-30 Thread Niall Pemberton
You simply need a property in your ActionForm that returns a collection of
"skill" beans and used the "indexed" attribute on the  tags. The
"isssue" that most people have problems with is when using a "Request" scope
ActionForm you need to populate your collection with the right number of
skill beans - the way to handle this is some kind of "lazy list" processing
for that property. Search the archives on indexed properties and lazy list
processing.

In your jsp...


   
   
Low
Medium
High
   


The trick is to name the "id" attribute to the same as the property in the
form which returns the collection, that way Struts will generate something
like:

 


The lazy ActionForms I wrote have the lazy list behaviour built in

http://www.niallp.pwp.blueyonder.co.uk/#lazydynabean

Niall


- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 30, 2004 6:19 PM
Subject: How to handle multiploe unknown form fields


> I have an interesting situation, one that has never come up before, and
I'm unsure how to deal with it...
>
> Imagine you have some records from a database representing various skills
(i.e., HTML, Javascript, J2EE, etc.).  Each has a SkillID associated with
it.
>
> You create a JSP that lists each skill with a drop-down next to it.  The
drop-down allows the user to select their skill level for each skill.
>
> When the user hits Save, you need to update all the skills for that user.
>
> That's the scenario.  Here's the question... Each drop-down is given the
name of the SkllID.  But how do you write an ActionForm for that?
>
> Since the database can be expanded to include new skills at any time, it's
impractical to add getters and setters for each SkillID, and in fact breaks
low coupling goals anyway.
>
> Is there a standard way of accepting what kind of amounts to an array of
inputs from a form and getting it into an ActionForm in some way (maybe as
an ArrayList or something?).
>
> TIA!



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



Re: How to handle multiploe unknown form fields

2004-09-30 Thread Bill Siggelkow
Frank,
Couldn't you create your  elements within ? 
You would need to dynamically generate the name attribute using an a 
RTEXPR (or using html-el tags).

Also, LazyActionForm might help here ...
[EMAIL PROTECTED] wrote:
I have an interesting situation, one that has never come up before, and I'm unsure how 
to deal with it...
Imagine you have some records from a database representing various skills (i.e., HTML, 
Javascript, J2EE, etc.).  Each has a SkillID associated with it.
You create a JSP that lists each skill with a drop-down next to it.  The drop-down 
allows the user to select their skill level for each skill.
When the user hits Save, you need to update all the skills for that user.
That's the scenario.  Here's the question... Each drop-down is given the name of the 
SkllID.  But how do you write an ActionForm for that?
Since the database can be expanded to include new skills at any time, it's impractical 
to add getters and setters for each SkillID, and in fact breaks low coupling goals 
anyway.
Is there a standard way of accepting what kind of amounts to an array of inputs from a 
form and getting it into an ActionForm in some way (maybe as an ArrayList or 
something?).
TIA!
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

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


How to handle multiploe unknown form fields

2004-09-30 Thread fzlists
I have an interesting situation, one that has never come up before, and I'm unsure how 
to deal with it...

Imagine you have some records from a database representing various skills (i.e., HTML, 
Javascript, J2EE, etc.).  Each has a SkillID associated with it.

You create a JSP that lists each skill with a drop-down next to it.  The drop-down 
allows the user to select their skill level for each skill.

When the user hits Save, you need to update all the skills for that user.

That's the scenario.  Here's the question... Each drop-down is given the name of the 
SkllID.  But how do you write an ActionForm for that?

Since the database can be expanded to include new skills at any time, it's impractical 
to add getters and setters for each SkillID, and in fact breaks low coupling goals 
anyway.

Is there a standard way of accepting what kind of amounts to an array of inputs from a 
form and getting it into an ActionForm in some way (maybe as an ArrayList or 
something?).

TIA!

Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]