The association is based on the ID of a component on the web page. If a JSF handler invokes the function, the message is placed at the location of a message or messages tag in the JSP.
The message is displayed when the related web page is displayed. You can use this function as part of a validation routine, or use it for informational messages.
If a validation function invokes sysLib.setErrorForComponentID(), the web page is redisplayed automatically when the function ends.
You can associate multiple messages with a component. If the JSF handler runs a forward statement, the messages are lost.
sysLib.setErrorForComponentID(
componentID STRING in,
msgKey STRING in
[, msgInserts STRING in])
Invalid file name {0}
This example shows an entry from the message file errorMessages_en_US.properties:
badname = The name you entered, {0}, is not valid.
userName STRING = getUserName(); // ask for input
rc = validateUserName(userName);
if (rc < 0)
SysLib.setErrorForComponentID( "form1:CustName",
SysLib.getMessage( "badname", [ userName ] ) );
end
| Platform | Issue |
|---|---|
| COBOL generation | The setErrorForComponentID() function is not supported |
| JavaScript generation | The setErrorForComponentID() function is not supported |