RE: question on if-then
"Goldsack, Patrick" <[email protected]>
| Newsgroups | gmane.comp.java.smartfrog.user |
|---|---|
| Message-ID | <[email protected]> |
Andreas,
Sorry about the slow reply - vacation...
As you have written the example, the second definition of msg1 overwrites
the first definition - so only the second has any effect on the result. So
setting the value of msg1 to "first" will simply set the value to "no
message found".
What you need to do is define msg1 as
msg1 IF (newMessage == "first") THEN "print the first message"
ELSE IF (newMessage == "second" THEN "print the second message"
ELSE "no message found"
FI FI
This should do what you want.
Patrick
-----Original Message-----
From: smartfrog-support-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:smartfrog-support-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Andreas
Unterkircher
Sent: 26 July 2004 14:05
To: smartfrog-support-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [Smartfrog-support] question on if-then
Hello,
I have a problem understanding IF ... THEN. The followin SF code borrowing
the components coming with the printer example should print "print the
first message" or "print the second message" according to whether
"newMessage" was set to "first" or "second" in sfConfig. If "newMessage"
is neither "first" or "second" then it should print "no message found".
Here's the code (includes omitted):
theGenerator extends Generator {
msg1 IF (newMessage == "first") THEN "print the first message" ELSE
"no message found" FI;
msg1 IF (newMessage == "second") THEN "print the second message" ELSE
"no message found" FI;
messages [msg1];
printer LAZY ATTRIB p;
}
thePrinter extends Printer {
name "printerA";
}
sfConfig extends Compound {
newMessage "first";
g extends theGenerator;
p extends thePrinter;
}
I played around with adding "LAZY", "ROOT" and so on in the "theGenerator"
component but either I get a parse error or it prints just "no message
found". How can I get the desired behaviour ?
Thanks,
Andreas
--
http://cern.ch/openlab
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Smartfrog-support mailing list Smartfrog-support-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/smartfrog-support
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com