Re: Passing data to another component
Re: Passing data to another component
- Subject: Re: Passing data to another component
- From: Johann Werner <email@hidden>
- Date: Tue, 27 Jul 2010 22:52:01 +0200
Hi Jeremy,
Am 27.07.2010 um 16:55 schrieb Jeremy Doseck:
> Hi, I've been trying to solve problem with passing inserted data to another page (component). Can anyone give me simple example how to do it?
> I need to pass written data by the user (WOString) to nextcomp.wo and display them there. Trying not to use inline bindings. Here I tried to do that:
>
> public String name;
> public Object goToAnotherComponent; //this is WOSubmitButton action binding
what is this line for? You bind your action to the method below.
>
> public nextcomp goToAnotherComponent() {
Having class that begin with lowercase letters is ok but you should stick to the usual java naming scheme. Your code will be better to read especially if your code base grows.
> nextcomp nextPage = (nextcomp)pageWithName("nextcomp");
> nextPage.setSelectedPopup(selectedNumber);
> nextPage.setName(name);
> return nextPage;
>
> I think I need to put some code in nextcomp.wo component to display set Value but have no idea how..
You have two choices here:
1. put into your nextcomp class two public ivars that will hold the values for selectedNumber and name. Then you can use KVC (Key Value Coding) to set those values:
nextPage.takeValueForKey(selectedNumber, "selectedPopup");
nextPage.takeValueForKey(name, "name");
Look at http://developer.apple.com/legacy/mac/library/documentation/InternetWeb/Reference/WO542Reference/com/webobjects/foundation/NSKeyValueCoding.DefaultImplementation.html for some more info.
2. put into your nextcomp class two ivars (not necessary public) and create setter methods for both. So for example for name you would have:
public String name;
public void setName(String name) {
this.name = name;
}
Hope this is helping you.
jw
>
> Thanks for the answers;
>
> Jeremy
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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