You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rick Reumann <ma...@reumann.net> on 2002/07/11 18:44:19 UTC

Re[2]: Should I bother to try and handle this with struts?

On Thursday, July 11, 2002, 12:22:57 PM, Eddie wrote:

EB> Use container-managed authentication.

Eddie, thanks for your info on container management but actually my
question really isn't about how to manage authentication. (I should
have been more clear).

It is how do you use Struts to generate form field names that will be
generated dynamically and then later have access to them to using an
Action Form or a configured Dynamic Action Form.

Let's change the whole scenario around and say I'm creating a page
that has a list of items and you have to select the favorite color of
each. For example:

car    [ select options of colors to choose ]
house  [ select options of colors to choose ]
sofa   [ select options of colors to choose ]

Now the problem is that the items are generated dynamically so that
the application doesn't know until run time what these items will be.

Is there a way to have a Struts Action Form manage gather this kind of
information.

I was hoping to avoid when the above form would submit having to do
this in some business object using the request object:

//get List from db
//loop through list and during each iteration:
       String colorValue = request.getParameter( itemInList );
       //now update db with this value for this item
//continue loop

Maybe I have no choice. I'm just not clear how I can use a Struts form
to capture this dynamic list of items, since I can't configure the
fields beforehand.

Thanks for any more help

-- 
Rick

EB> Rick Reumann wrote:

>>I'm confused how I can/should handle this in Struts...
>>
>>What I need to build (and long story why) is a User Administration
>>utility and where I'm having trouble fitting this in with struts is in
>>regard to the following:
>>
>>Picture a case where you want to give user's certain roles based on
>>certain applications. So you'd have:
>>
>>BackofficeApp    [ select options of possible roles ]
>>JoeBlowApp       [ select options of possible roles ]
>>DumbApp          [ select options of possible roles ]
>>
>>The problem is the list of applications is dynamic so I can't hard
>>code these values into a form bean or in my dynamicActionForm.
>>
>>Currently I'm planning on doing this an old fashioned way where after
>>submission I'll loop through the same dynamic list of applications and
>>pull up the request parameters based on the values I get back. So for
>>example somewhere I'd end up doing:
>>
>>//while loop through applications
>>String appValue = request.getParameter( appNameBasedOnCurrentLoopValue );
>>       //update db for this app name based on value
>>//continue loop
>>
>>Can I have a form bean gather all this data? Or should I just continue
>>to do it the way I'm doing it?
>>
>>Thanks for any comments/help.
>>
>>
>>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Should I bother to try and handle this with struts?

Posted by Eddie Bush <ek...@swbell.net>.
Please note that I have not used the items I am about to tell you about 
:-)  That having been said:

DynaForms - from what I understand, they will "suck up" anything and 
poke it in a hash.  I'm not sure whether you could use this - or maybe 
DynaBeans - but, from my (limited) understanding of them, I think you 
probably could.  Internally, as I said, they poke things into a hash. 
 Now ... hrm ... I need to catch up on the new Struts features :-)

I really think you can acheive this.  To get someone elses attention, 
post a new topic about "Help with DynaBeans/DynaForms".  That's nearly 
certain to get someone's attention.

HTH,

Eddie

Rick Reumann wrote:

>On Thursday, July 11, 2002, 12:22:57 PM, Eddie wrote:
>
>EB> Use container-managed authentication.
>
>Eddie, thanks for your info on container management but actually my
>question really isn't about how to manage authentication. (I should
>have been more clear).
>
>It is how do you use Struts to generate form field names that will be
>generated dynamically and then later have access to them to using an
>Action Form or a configured Dynamic Action Form.
>
>Let's change the whole scenario around and say I'm creating a page
>that has a list of items and you have to select the favorite color of
>each. For example:
>
>car    [ select options of colors to choose ]
>house  [ select options of colors to choose ]
>sofa   [ select options of colors to choose ]
>
>Now the problem is that the items are generated dynamically so that
>the application doesn't know until run time what these items will be.
>
>Is there a way to have a Struts Action Form manage gather this kind of
>information.
>
>I was hoping to avoid when the above form would submit having to do
>this in some business object using the request object:
>
>//get List from db
>//loop through list and during each iteration:
>       String colorValue = request.getParameter( itemInList );
>       //now update db with this value for this item
>//continue loop
>
>Maybe I have no choice. I'm just not clear how I can use a Struts form
>to capture this dynamic list of items, since I can't configure the
>fields beforehand.
>
>Thanks for any more help
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>