Re: Passing URL parameters to component via direct action
Re: Passing URL parameters to component via direct action
- Subject: Re: Passing URL parameters to component via direct action
- From: William Hatch <email@hidden>
- Date: Mon, 11 Aug 2008 15:14:16 -0400
Hi John,
It sounds like you want to call a DA, then return the same page you
were on when calling the DA, and have the page contain the same values
it had before you called the DA. Correct?
If so, you can just pass all of the values you need to the da as
request parameters, outlined previously, and then make sure your
component can set them with either standard getters and setters or
using KVC. Any other things required to render should be able to be
derived from what you're setting up in the component during the DA.
Bill
On Aug 11, 2008, at 12:29 PM, John Pollard wrote:
Lachlan,
On 11 Aug 2008, at 13:29, Lachlan Deck wrote:
On 11/08/2008, at 10:10 PM, John Pollard wrote:
I have a page containing a WOForm with some dynamically created
WOPopUpButtons. The WOForm is set to submit a Direct Action
request (using get as opposed to post).
The request received by the DA method contains information from a
couple of hidden fields in the form which allows me to construct
and configure the right page which is actually just a new instance
of the same page.
Is there a really simple way to get the WOPopUpButton values from
the request DA URL into the WOForm as if the WOForm had been
submitted with those values as a component action?
public String getSomeSelectedValue()
{
if ( someSelectedValue == null )
someSelectedValue =
context().request().stringFormValueForKey( "someSelectedValue" );
return someSelectedValue;
}
Yes, that's fine, I can get a named value no problem. But here I am
referring to an array of dynamically generated named values that
make up a WOForm content. My feeling is that I shouldn't need to
pick out the values, the WOForm should be able to take them from the
request, even if the request comes via a DA.
I tried calling takeValuesFromRequest(request(), context()) from
my DA method but that produced a NPE. Perhaps this method can't
work from a DA request/context?
What's the stack trace?
I expect the above call makes no sense anyway, it was a long shot.
However, if someone says this should work, I'll give a stack trace.
Obviously I can parse the DA request, dig out the WOPopUpButton
selections and pass them to the page myself and set the popup
selections, but it strikes me that there ought to be an easy way.
There's lots of ways to do things.
I'm just looking for the lazy man's way that will save me picking
out values now and in the future when I need to do similar again.
I will look at David LeBer's articles and podcasts as advised by
Ramsey and see if that helps.
Thanks,
John
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden