setError()

The system function SysLib.setError associates a message with a field in a PageHandler or VGUIRecord or with a PageHandler as a whole:
  • If a PageHandler invokes the function, the message is placed at the location of a message or messages tag in the JSP.
  • If a program of type VGWebTransaction invokes the function, the message is placed at the location of the font tag in the JSP.

The message is displayed when the related Web page is displayed.

If a validation function invokes SysLib.setError, the Web page is re-displayed automatically when the function ends.

The first of the following three syntaxes are available in PageHandlers or in programs of type VGWebTransaction, while the second and third are available only for PageHandlers:

  SysLib.setError(
    fieldInError anyPageField in,
    msgKey STRING in
    {, fieldInsert sysLibFieldInsert in})
  SysLib.setError(
    this enumerationThis in,
    msgKey STRING in
    {, fieldInsert sysLibFieldInsert in})
  SysLib.setError(msgText STRING in)
fieldInError
If SysLib.setError is issued from a PageHandler, fieldInError is a field in the PageHandler.

If SysLib.setError is issued from a program, fieldInError is a field in the record that is specified in the show or converse statement.

this
Refers to the PageHandler from which SysLib.setError is issued. In this case, the message is not specific to a field, but is associated with the PageHandler as a whole. For details on this, see References to variables and constants.
msgKey
A character field or literal (type CHAR or MBCHAR) that provides the key into the message resource bundle or properties file used at run time. If the key is blank, the message is a concatenation of message inserts.
fieldInsert
The character field or literal that is included as an insert to the output message. The substitution symbol in message text is an integer surrounded by braces, as in this example:
  Invalid file name {0}
msgText
The character field or literal that you can specify if you do not specify other arguments. The text is associated with the page as a whole.

You can associate multiple messages with a field or with the PageHandler. The messages are lost if control is forwarded; specifically, if the PageHandler runs a forward statement or if the VGWebTransaction program runs a transfer statement.

Related reference
EGL library SysLib
forward

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.