RE: how to pass an object
RE: how to pass an object
- Subject: RE: how to pass an object
- From: "Kranthi Sagar Borra" <email@hidden>
- Date: Thu, 8 Jan 2004 13:02:18 +0530
- Thread-topic: how to pass an object
Hi Robert,
Thanks for that.I need to handle it the way that I am doing instead of allowing EOF handle it.I have few questions here.This is my requirement :when the user clicks on a icon he should be able to view the image.I used WOActiveImage for this and asociated a method to the action.On click of this image the action method will be invoked.It is in this action method that I am firing the query to fetch the object.And now as you said I have done the following
String sqlQuery="select PictureObj from ProblemPicture where ProblemID = "+theProblem.getProblemID();
String result = query.getCellAsString(1,1);
NSData ImageBLOBData=new NSData(result);
I have mapped ImageBLOBData to data in WOActiveImage.but when I also specify the filename in WOActiveImage, both these fields are turning red but if I dont mention the filename then it saving without problems.I still compiled my application without giving the filename.but now when I click on the icon, the method is getting called as expected but I cannot see any image.can you please help me in this.II need to complete this by today.I shall be thankful if you can provide me a solution.
Regards,
Kranthi Sagar
> ----------
> From: Robert Walker
> Sent: Thursday, January 8, 2004 12:11 PM
> To: WebObjects Dev
> Subject: Re: how to pass an object
>
> Kranthi,
>
> I assume your image in contained in an NSData object after you get it
> from the database. If this is correct then you would use a WOImage
> element in the component and bind the image data to the "data" binding
> and bind a string "image/jpeg" or "image/gif" to the "mimeType"
> binding.
>
> That's all!
>
> P.S. It sounds like you may be calling some sort of SQL statement
> directly (based on your description below). If that's the case I'm
> wondering why you are doing that, instead of letting EOF handle all the
> SQL stuff for you.
>
> Getting the image data the EOF way would look something more like this:
>
> Picture myPicture; //assume this exists
> NSData theImageData = myPicture.imageData();
>
> or the key value coding way like:
>
> EOEnterpriseObject myPicture; //assume this exists
> NSData theImageData = (NSData)myPicture.valueForKey("imageData");
>
> On Jan 8, 2004, at 12:24 AM, Kranthi Sagar Borra wrote:
>
> > Hi,
> >
> > I have and image file stored in the database as a BLOB object.Now when
> > I fire a query on the database as
> > Select <object> from <tablename>
> > I get the object.But now my question is , how do I pass this object
> > to the front(browser) so that the user is able to view the picture.
> > Thanks in advance.
> >
> > Regards,
> > Kranthi Sagar
> > _______________________________________________
> > 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.
> >
> >
> --
> Sincerely,
> Robert Walker
> _______________________________________________
> 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.
_______________________________________________
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.