• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WO Tutorial - Component Communication
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WO Tutorial - Component Communication


  • Subject: Re: WO Tutorial - Component Communication
  • From: Cameron Knowlton <email@hidden>
  • Date: Sun, 5 Jan 2003 22:07:05 -0700

I put in a diagnotistic test in the noDataEntered method; sure enough, I get back "user == null".

Below is my Main.java file... sorry for those on digest.

Quick question: In the Groups & Files / Classes folder, I have listed:

Application.java
Session.java
DirectAction.java
User.java

To the left of these, there's a checkbox... but I can't find in the documentation what that indicates.

thanks,
Cameron Knowlton


------------

//
// Main.java: Class file for WO Component 'Main'
// Project ComponentCommunication
//
// Created by cameronk on Sun Jan 05 2003
//

import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;

public class Main extends WOComponent {
    protected User user;

    public Main(WOContext context) {
        super(context);
    }



/**
 * Determines whether the user has entered data into <code>user</code>.
 *
 * @return true when the user has entered data into
 *         user.
**/

    public boolean noDataEntered() {
        boolean noDataEntered;
        if (user == null) {
            System.out.println("user == null");
        }
        else {
            if (user.entryIncomplete()) {
                System.out.println("user.entryIncomplete");
            }
        }
            if (user == null || user.entryIncomplete()) {
            noDataEntered = true;
        }
        else {
            noDataEntered = false;
        }
        return noDataEntered;
    }


    public User user()
    {
        return user;
    }
    public void setUser(User newUser)
    {
        user = newUser;
    }

    public UserEdit editUser()
    {
        UserEdit nextPage = (UserEdit)pageWithName("UserEdit");

        if (user == null) {
            user = new User();
        }

        // Send user to the UserEdit page.
        nextPage.setUser(user);

        return nextPage;
    }

}

------------


>Did you set the 'negate' binding on your WOConditional? It should either be un-set, or set to 'false' so that the content within the WOConditional will be shown only if noDateEntered() returns true.
>
>In reply to your other message, I am not a C programmer, but it looks as though you have your methods in the correct place.
>
>public class Main extends WOComponent {
>
>    public Main(WOContext context) {
>        super(context);
>    }
>
>    // Your methods here
>
>}
>
>If they were terribly out of place, I image the compiler would complain.
>
>patrick
>
>
>
>On Sunday, January 5, 2003, at 04:13  PM, Cameron Knowlton wrote:
>
>>p.s. I'm not getting an error message, but after submitting the form, I get the 'No data entered' message.
>>
>>Checking the logic, I find that the assertion:
>>
>>	if (user == null)
>>
>>is testing true, so the WOConditional fires wrong.
>>
>>
>>thanks again,
>>Cameron Knowlton
>>
>>>Looks ok to me as long as you have something like...
>>>
>>>	protected User user;
>>>
>>>... in Main.java, and the User.java class is added to the application server.
>>>
>>>What error are you getting? Every so often it help to "Clean" your application by clicking on the clean (broom) button in Project Builder.
>>>
>>>patrick
>>>
>>>
>>>On Sunday, January 5, 2003, at 01:23  PM, Cameron Knowlton wrote:
>>>
>>>>Greetings, and a question from the newbie:
>>>>
>>>>I'm working through the tutorial, but I'm stuck on the final run of the ComponentCommunication project.
>>>>
>>>>Specifically, the noDataEntered() function is failing on its test of
>>>>
>>>>  if (user == null)
>>>>
>>>>It would seem that my user doesn't get instantiated. I do have the code in Main.java:
>>>>
>>>>----------
>>>>  public UserEdit editUser()
>>>>  {
>>>>      UserEdit nextPage = (UserEdit)pageWithName("UserEdit");
>>>>
>>>>      if (user == null) {
>>>>          user = new User();
>>>>      }
>>>>
>>>>      // Send user to the UserEdit page.
>>>>      nextPage.setUser(user);                return nextPage;
>>>>  }
>>>>----------
>>>>
>>>>Any ideas?
>>>>
>>>>thanks in advance,
>>>>Cameron Knowlton
>>>>_______________________________________________
>>>>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.

  • Prev by Date: Accessing Database
  • Next by Date: More Info on Error
  • Previous by thread: WO Tutorial - Component Communication
  • Next by thread: Re: WO Tutorial - Component Communication
  • Index(es):
    • Date
    • Thread