Re: Obtaining the elementID
Re: Obtaining the elementID
- Subject: Re: Obtaining the elementID
- From: Chuck Hill <email@hidden>
- Date: Wed, 26 Oct 2005 11:59:56 -0700
Some more thoughts on why this is the way it is and why there is no
componentForElementID(String id) method on WOComponent:
You could hack something out by doing this:
public WOActionResults invokeAction( WOContext aContext,
WORequest aRequest ) {
if ( aContext.senderID().equals( aContext.elementID() ) ) {
aContext().page().registerComponentForElementID(this,
aContext.elementID());
}
return super.invokeAction(aContext, aRequest);
}
But you would run into problems with stateless components and
dynamic elements as their state depends on the exact state of the
tree traversal when they are accessed. And the element you are
trying to access may have been hidden during another phase leading to
inconsistencies down the line and the introduction of security breaches.
Chuck
On Oct 26, 2005, at 11:49 AM, Stephane Guyot wrote:
Miguel,
Have a look on the examples : /Developer/Examples/JavaWebObjects/
Frameworks/WOComponentElements
In WXActionURL.java you have exactly what you a looking for :
/**
* Override of invokeAction method - this method is used to
perform the action
* from the bindings. This method matches the sender ID with
the element ID
* (to ensure this is the instance we want) and then returns
the action from
* the bindings.
*/
public WOActionResults invokeAction( WOContext aContext,
WORequest aRequest ) {
if ( aContext.senderID().equals( aContext.elementID() ) ) {
return (WOActionResults)valueForBinding( "action" );
}
return null;
}
}
HTH,
Stephane
Le 25 oct. 05, à 00:33, Miguel Arroz a écrit :
Hi!
I'm trying some AJAX stuff, and I need to work with the element
IDs of the objects. While building the page, i just ask the
context what is the current elementID(). But how do I do the
reverse operation? How can I ask the context what is the object
associated with some ID?
Yours
Miguel Arroz
"The world lies in the hands of evil
And we pray it would last" -- Apocalyptica, Life Burns!
Miguel Arroz
http://www.ipragma.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
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:
40global-village.net
This email sent to email@hidden
--
Coming in 2006 - an introduction to web applications using WebObjects
and Xcode http://www.global-village.net/wointro
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems. http://www.global-village.net/products/practical_webobjects
_______________________________________________
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