You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jim Reynolds <ji...@gmail.com> on 2006/10/31 18:44:29 UTC

Mailreader2 question

After analyzing the Mailreader2 application, I cannot figure out these
three lines of the Welcome.java file, full class below:

    String message = getText(Constants.ERROR_DATABASE_MISSING);
    if (Constants.ERROR_DATABASE_MISSING.equals(message)) {
      addActionError(Constants.ERROR_MESSAGES_NOT_LOADED);
    }

Wouldn't we always be adding an ActionError? Does getText do something
that I am not seeing in the API?

Thanks,







########
The Welcome Action class

package mailreader2;
public class Welcome extends MailreaderSupport {

  public String execute() {

    // Confirm message resources loaded
    String message = getText(Constants.ERROR_DATABASE_MISSING);
    if (Constants.ERROR_DATABASE_MISSING.equals(message)) {
      addActionError(Constants.ERROR_MESSAGES_NOT_LOADED);
    }

    // Confirm database loaded
    if (null==getDatabase()) {
      addActionError(Constants.ERROR_DATABASE_NOT_LOADED);
    }

    if (hasErrors()) {
      return ERROR;
    }
    else {
      return SUCCESS;
    }
  }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org