Problem with Direct Action
Problem with Direct Action
- Subject: Problem with Direct Action
- From: Gilles MATHURIN <email@hidden>
- Date: Fri, 5 Jan 2007 08:02:49 -0400
Hello all,
I get a weird bug when using a direct action bound to a dynamic
hyperlink.
First let me say where i come from in the app navigation :
Page A displays infos on a Personn like his name, biography and a
table of his albums in a WOTable with a WORepetition in it.
When u click on one of these albums name, u should go to an AlbumPage
which displays more information on it.
To do so, i made a WOHyperlink around the creationItem.name, here is
the wod config for this hyperlink :
====================
Hyperlink1: WOHyperlink {
directActionName = "voirAlbumPage";
actionClass = "DirectAction";
?albumchoisi = albumItem.pkValue;
}
====================
where albumItem.pkValue return the primary key of the creationItem
and pass it to the DA.
Here is the DA method
====================
// DA qui renvoie à AlbumPage
public WOActionResults voirAlbumPageAction() {
AlbumPage nextPage = (AlbumPage)pageWithName("AlbumPage");
String pk = (String)this.request().formValueForKey("albumchoisi");
nextPage.setAlbumChoisiID(pk);
return nextPage;
}
====================
And here is the appendToResponse Method in the destination page who
should fetch the right EO based on the pk transmitted and then
display the informations on it with its relationships infos by KVC .
===================
public void appendToResponse(WOResponse response,WOContext context) {
EOEditingContext ec = new EOEditingContext();
NSMutableDictionary pkDict = new NSMutableDictionary();
pkDict.setObjectForKey(new Integer(Integer.parseInt
(albumChoisiID)), "albumId");
try {
ec.lock();
this.setAlbumChoisi((Album)EOUtilities.objectWithPrimaryKey
(ec,"Album",pkDict));
} finally {
ec.unlock();
}
/*this.selectionAvis(albumChoisi());
this.setAUrl(dynamicURL());*/
super.appendToResponse(response,context);
}
====================
Must mention that i use the same pattern for the Page A which display
the Person infos.
But here is the stack trace i get when cliking on the link to go to
the DetailCreationPage :
====================
Error:
com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException:
valueForKey(): lookup of unknown key: 'albumid'. This class does not
have an instance variable of the name albumid or _albumid, nor a
method of the name albumid, _albumid, getAlbumid, or _getAlbumid
Reason:
<Album 0x46b158> valueForKey(): lookup of unknown key: 'albumid'.
This class does not have an instance variable of the name albumid or
_albumid, nor a method of the name albumid, _albumid, getAlbumid, or
_getAlbumid
i have put several NSLog.out to control the variable at different
level and they all have the primary key integer of the clicked album
name… so i don't get it.
If someone can make me see the ligth, i will appreciate a lot.
Thanks.
GM _______________________________________________
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