public class ErrorMessageForEach extends ForEach
The list of exceptions can be specified as an input parameter in one of two ways. If you do not define a source for exceptions, the list of all exceptions that have occurred in this request is used.
Otherwise, you can specify a Vector of ServletException s as the exceptions parameter. For example, you'd add this parameter to the invocation of this servlet in a jhtml file:
<param name="exceptions" value="bean:MyFormHandler.formExceptions">
The exceptions are translated into error messages using a pair of mapping
tables. One keys off
of the errorCode
property of the exception, the other keys off
of its propertyName
. The tables supply specific errors
to display for each exception that are likely to be encountered.
If no entry is provided for a errorCode or a propertyName, the original
message property in the exception is printed.
The mapping tables are created by taking the union of two different dictionaries. The default dictionary is defined with the propertyNameTable and messageTable bean properties of this servlet. The other dictionary is taken from a the propertyNameTable and messageTable request parameters passed to the servlet.
Each exception can either have an entry in the message table, the property name table or both. If both entries are present, the "message" table entry is displayed but it can use the sequence "param:propertyName" to substitute the contents of the "propertyName" table entry.
This servlet takes the same parameters as the servlet atg.droplet.ForEach to control how the exceptions are displayed. Each time that the output parameter is rendered, this servlet sets "message" and "propertyName" parameters which contain the translated values.
Note that propertyName is only associated with DropletFormExceptions - those exceptions that are generated in a failure to set the value of a bean property. For ServletExceptions, the propertyName entry is not set.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
ARRAY, COUNT, DEBUG, ELEMENT, ELEMENT_NAME, EMPTY, INDEX, INDEX_NAME, KEY, OUTPUT, OUTPUT_END, OUTPUT_START, REVERSE_ORDER, SIZE, SORT_PROPERTIES
mAllowCleanupRequest, mParameters
SERVLET_INFO_KEY
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
ErrorMessageForEach() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getArray(DynamoHttpServletRequest pReq)
Returns the Vector of exceptions to display.
|
java.util.Properties |
getMessageTable() |
java.util.Properties |
getPropertyNameTable() |
java.lang.String |
getResourceName() |
protected void |
setElementParameter(DynamoHttpServletRequest pReq,
java.lang.String pElementName,
java.lang.Object pValue)
In this method, we extract the message and propertyName values that
we want to render in the request first mapping them through the
tables provided.
|
void |
setMessageTable(java.util.Properties pMessageTable)
Sets the property MessageTable.
|
void |
setPropertyNameTable(java.util.Properties pPropertyNameTable)
Sets the property PropertyNameTable.
|
void |
setResourceName(java.lang.String pResourceName)
Sets the property ResourceName.
|
getSortedArray, service, serviceArray, serviceCollection, serviceDictionary, serviceEnumeration, serviceIndexedList, serviceIterator, serviceMap, serviceMapArray, servicePrimitiveArray
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, init, service, service, setParameter
destroy, getServletConfig, getServletInfo, setServletInfo
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService, toString
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public void setResourceName(java.lang.String pResourceName)
public java.lang.String getResourceName()
public void setMessageTable(java.util.Properties pMessageTable)
public java.util.Properties getMessageTable()
public void setPropertyNameTable(java.util.Properties pPropertyNameTable)
public java.util.Properties getPropertyNameTable()
public java.lang.Object getArray(DynamoHttpServletRequest pReq)
protected void setElementParameter(DynamoHttpServletRequest pReq, java.lang.String pElementName, java.lang.Object pValue)
setElementParameter
in class ForEach