Re: Passing data to another component
Re: Passing data to another component
- Subject: Re: Passing data to another component
- From: Jeremy Doseck <email@hidden>
- Date: Sun, 1 Aug 2010 01:23:49 +0900
Hi Johann,
Thank you for your explanations and example.
I tried to do it with first option.
public String name;
public void setName(String name) {
this.name = name;
}
I had some struggle with it but finally, I made it!
In fact, I am trying to do contact form with some textfields and popups, with required fields in it. Then display selected values on the next page (after clicked on the submit) in some proper table, then send to the mail..
anyway, thanks again.
Jeremy
2010/7/28 Johann Werner
<email@hidden>
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
_______________________________________________
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