Direct Action is not getting called
Direct Action is not getting called
- Subject: Direct Action is not getting called
- From: Greg Hulands <email@hidden>
- Date: Fri, 28 Nov 2003 08:05:54 +1000
Hi,
I am having trouble in getting my direct action to be called. Below is
the class for where it is declared. In the browser I have the
following:
var img = new Image();
img.src =
"http://localhost//cgi-bin/WebObjects/LightBox.woa/wa/DirectAction/
consumerSetAnnotationForImage?image=7563a13f-7a82-4249-b134
-1dacc079470e/f21538a6-9455-4d38-92a6-
bcf14afd9589.jpg&title=My New Title";
The src is autogenerated via javascript so that it can be used for all
the images on the page. I assign the src to the img so that it updates
the WO app. The img is just a temp variable so that the user doesn't
know that there was a trip to the server and makes the app look more
responsive.
I have tried adding /consumerSetAnnotationForImageAction? as well, but
it doesn't seem to be getting called either. I have tried removing
DirectAction in the url as well, but still no success.
Any ideas?
Greg
public class DirectAction extends WODirectAction {
public DirectAction(WORequest aRequest) {
super(aRequest);
}
public WOActionResults defaultAction() {
return pageWithName("Main");
}
public WOComponent consumerSetAnnotationForImageAction() {
String image = context().request().stringFormValueForKey("image");
String annotation =
context().request().stringFormValueForKey("title");
EOEditingContext ec = new EOEditingContext();
EOQualifier qualifier =
EOQualifier.qualifierWithQualifierFormat("thumbnail = %@", new
NSArray(image));
EOFetchSpecification fetchSpec = new
EOFetchSpecification("ClientImage", qualifier, null);
ec.lock();
NSArray results = ec.objectsWithFetchSpecification(fetchSpec);
if (results.count() > 0)
{
ClientImage img = (ClientImage)results.objectAtIndex(0);
img.setAnnotation(annotation);
ec.saveChanges();
}
ec.unlock();
ConsumerImageAnnotation next =
(ConsumerImageAnnotation)pageWithName("ConsumerImageAnnotation");
next.setTitle(annotation);
return next;
}
}
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.