Re: Newbie : Help to include a WOFileUpload as a D2WCustomComponent
Re: Newbie : Help to include a WOFileUpload as a D2WCustomComponent
- Subject: Re: Newbie : Help to include a WOFileUpload as a D2WCustomComponent
- From: Gilles MATHURIN <email@hidden>
- Date: Thu, 17 Aug 2006 18:24:06 -0400
So if i understand, what you adive me is to not follow the method of
the WebObjects D2W Guide regarding the Creating a Custom Property-
level Component, but to write my own method (or Component) to store
the file in the database ?
It starts being complicated, isn't it ?
Regards.
GM
Le 17 août 06 à 18:06, Chuck Hill a écrit :
On Aug 17, 2006, at 3:00 PM, Gilles MATHURIN wrote:
What do you mean by i don't need to do this…
i try to follow the EditPopUp example from the D2W Guide, with the
help of R.Walker for a better understanding of it (thanks again)
and now the D2WApp is blocked…
a little enlightment ? :-)
I don't see why you need the takeValuesFromRequest method at all.
Take it out. I also don't see any relation to D2W...
Chuck
Regards.
GM.
Le 17 août 06 à 17:09, Chuck Hill a écrit :
On Aug 17, 2006, at 2:02 PM, Gilles MATHURIN wrote:
Hello all,
I took some vacations on St-Marteen Island, and i am back now,
hope you had a great last week.
I think this list has a no gloating rule. :-P
I see that the discusison on the WOCommunity Topic has been
exciting and rich
I'd like to contribute even i don't know how still.
Meanwhile, i need some clue to implement a WOFileUpload as a
D2WCustomComponent
I managed to create a partial component and it displays in the
D2WApp, but the file i choose is not saved in the database…
Here my files :
===
The CustomComponent : UploadDataPage
===
import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;
public class UploadDataPage extends WOComponent {
protected NSData aFileContents;
protected String aMimeType;
protected String aUrl;
protected EOEnterpriseObject object;
protected String key;
public UploadDataPage(WOContext context) {
super(context);
}
public void takeValuesFromRequest(WORequest request, WOContext
context) {
object.takeValueForKey(aFileContents, key);
Ouch! (a) You don't need to do this and (b) if you override
methods declared in the frameworks, you should almost always call
super:
super.takeValuesFromRequest(request, context);
}
Chuck
public WOComponent addFile() {
object.takeValueForKey(aFileContents, key);
return null;
}
}
===
The Wod File
===
FileUpload1: WOFileUpload {
data = aFileContents;
mimeType = aMimeType;
}
Form1: WOForm {
enctype = "mutlipart/form-data";
}
SubmitButton1: WOSubmitButton {
action = addFile;
value = "Click Here when done";
} _______________________________________________
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
--
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
--
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