Anil,
 
There is no way you can specify the name of an outcome just once and use
a reference to it both in the java-code of your managed-bean and the
navigation-rules in your faces-config.xml. Since your faces-config.xml
doesn't get build or compile, there is no way to garantee that the
values used for outcomes are 'valid' and match the String you use in the
managed-bean.
 
For me it works fine to create a Outcomes-class which contains a set of
static final String for all outcomes I use through out the entire
application. It allows to reference to those outcomes in your
managed-bean and set JavaDoc on the outcome-constants to spefify the
String to use in the faces-config.xml.
 
public class Outcomes {
    /**
     * Outcome use to proceed to the next step in a wizard: "continue".
     */
    public static final String CONTINUE = "continue";
}
 
managed-bean:
 
public String someMethod() {
  return Outcomes.CONTINUE;
}
 
This doesn't prevent you from making mistakes and errors in typing the
value for from-outcome, but does offer you the possibility to re-use
your code better and made changes easier by allowing you to refactor
your code instead of performing 'global' search and replace-action on
your Strings used as outcomes.
 
With kind regards,
  Marco Beelen
 
 
 
 
 
 
 
 
________________________________

From: Anil Kommareddi [mailto:[EMAIL PROTECTED] 
Sent: woensdag 20 december 2006 20:00
To: users@myfaces.apache.org
Subject: OT: from-outcome value


Folks,
Has anyone devised or know of a pattern to be able to use a reference to
a constant string or property file in the from-outcome tag of a
navigation-case instead of 'hardcoding' the actual string there?

My objective here is to maintain a common repository of outcomes either
in a class or property file and refer to them from both the action
method and the navigation case.

Thanks - Anil.


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD
and in Japan, as Banyu - direct contact information for affiliates is 
available at http://www.merck.com/contact/contacts.html) that may be 
confidential, proprietary copyrighted and/or legally privileged. It is 
intended solely for the use of the individual or entity named on this 
message. If you are not the intended recipient, and have received this 
message in error, please notify us immediately by reply e-mail and then 
delete it from your system.

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

Reply via email to