Re: Event handling question
Re: Event handling question
- Subject: Re: Event handling question
- From: Chuck Hill <email@hidden>
- Date: Thu, 03 Apr 2003 19:25:36 -0800
I'm not familar with this, but it sounds as if there are two
WOConditionals, one nested inside of the other, and both bound to
entryIncomplete(). Thus if the first WOConditional evaluates to false the
inner one never gets evaluated and there is only one call. if the first
WOConditional evaluates to true then the inner one also gets evaluated and
there are two calls.
Chuck
At 05:48 PM 03/04/2003 -0500, Richard L. Peskin wrote:
>At the end of this message is the Main.java code from Chapter 5
>(Derived Properties) of Web Objects 5 (Web Applications) which is the
>booklet distributed with WO 5.2. The application consists of two
>WOConditionals, one wrapping a simple Form with two user input text
>fields and the other wrapping two text fields. My question concerns the
>adduser() method which is triggered when the Submit button is pressed.
>If the "entryIncomplete" is true (user didn't fill in text fields) the
>console message from addUser() is printed. But if "entryIncomplete" is
>false (triggering the else branch in entry(incomplete()), the addUser()
>message is not printed and the message in that else branch is printed
>twice????
>--dick peskin
>---------
>//
>// Main.java: Class file for WO Component 'Main'
>// Project UserEntry
>//
>// Created by rpeskin on Mon Mar 31 2003
>//
>
>import com.webobjects.foundation.*;
>import com.webobjects.appserver.*;
>import com.webobjects.eocontrol.*;
>import com.webobjects.eoaccess.*;
>
>public class Main extends WOComponent {
> protected String personName;
> protected String favoriteFood;
> public Main(WOContext context) {
> super(context);
> }
>
> /* print to console */
> public void awake() {
> super.awake();
> System.out.println(this.getClass().getName() + "'s awake
>invoked.");
> }
>
> public String personName()
> {
> return personName;
> }
> public void setPersonName(String newPersonName)
> {
> System.out.println("Setting personName to " + newPersonName);
> personName = newPersonName;
> }
>
> public String favoriteFood()
> {
> return favoriteFood;
> }
> public void setFavoriteFood(String newFavoriteFood)
> {
> System.out.println("Setting favoriteFood to " +
>newFavoriteFood);
> favoriteFood = newFavoriteFood;
> }
>
> public WOComponent addUser()
> {
> System.out.println("Submit Button clicked" );
> System.out.println();
> return null;
> }
>
> public boolean entryIncomplete()
> {
> boolean entryIncomplete;
> if (personName == null || favoriteFood == null ||
> personName.equals("") || favoriteFood.equals("") ){
> System.out.println("The entry is incomplete.");
> entryIncomplete = true;
> }
> else {
> System.out.println("The entry is complete.");
> entryIncomplete = false;
> }
>
> return entryIncomplete;
> }
>}
>--------------------------
>
>
>Richard L. Peskin, RLP Consulting, Londonderry, VT
>http://www.rlpcon.com
>http://www.caip.rutgers.edu/~peskin
>_______________________________________________
>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.
>
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
_______________________________________________
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.