com.ibm.dse.cs.html
Class DSEJspContextServices

java.lang.Object
  |
  +--com.ibm.dse.cs.html.DSEJspContextServices

public class DSEJspContextServices
extends java.lang.Object
implements JspContextServices

This class implements the JspContextServices interface.

It receives the operation context from the request and provides various interfaces to access the context information.


Field Summary
protected  java.lang.String baseWebPath
          The base web path string
protected  DSEException dseexception
          The current operation exception
protected  java.lang.String errorMarker
          The error marker value
protected  java.lang.String errorPrefix
          The error decorator "prefix" value
protected  java.lang.String errorSuffix
          The error decorator "suffix" value
protected  Vector errsJsp
          The JSP format errors list
protected  java.lang.String[] errsVal
          The validation errors list
protected  java.lang.String[] errsXVal
          The cross-validation errors list
protected  java.lang.String extraPathInfo
          The locale (extra path) string.
protected  Context operationContext
          The operation context.
protected  java.lang.String pageId
          The pageId for the displaying page
protected  Context sessionContext
          The session context.
protected  java.lang.String sessionID
          The session id string
 
Constructor Summary
DSEJspContextServices()
          DSEJspContextServices default constructor.
 
Method Summary
 double asDouble(java.lang.String strval)
          Useful service for converting a String into it's equivalent double value.
 float asFloat(java.lang.String strval)
          Useful service for converting a String into it's equivalent float value.
 int asInt(java.lang.String strval)
          Useful service for converting a String into it's equivalent integer value.
 long asLong(java.lang.String strval)
          Useful service for converting a String into it's equivalent long value.
 java.lang.String getBaseWebPath()
          Obtain the relative path for jsp resources.
 Context getContext()
          Get the operation context for the page which initialized this bean.
 java.lang.String[] getCrossValidationErrorList()
          Return the current list of cross validation errors.
 DataElement getElement(java.lang.String name)
          Returns the named data element from the operation context.
protected  DataElement getElement(java.lang.String name, boolean useSess)
          Insert the method's description here.
 java.lang.String getErrorPageHtml(java.lang.String name)
           
 DSEException getException()
          If the framework placed an exception in the HttpServletRequest with key name dseexception, then it can be saved here when the bean is initialized.
 java.lang.String getExceptionMessage()
          Return message text cooresponding to the current exception.
 java.lang.String getFieldErrorMarker(java.lang.String name)
          Return the current error marker only if the given field is in error.
 java.lang.String getFieldLabel(java.lang.String name)
          Returns the label associated with the given field in the context.
 java.lang.String getFieldValidationError(java.lang.String name, int idx)
          Return the field error message text at the specified index.
 java.lang.String getFieldValidationErrorDecorated(java.lang.String name, int idx)
          Return the field error message text at the specified index decorated with prefix and suffix HTML strings.
 java.lang.String[] getFieldValidationErrorList(java.lang.String name)
          Retrieve the entire error list for the field.
 java.lang.String[] getJspFormatErrorList()
          Returns the list of Jsp Format Errors that were found during Jsp Processing.
 java.lang.String getLinkToPage(java.lang.String webPath, java.lang.String pageName, java.lang.String linkText)
          Emit the Html to the JspWriter stream to create a link with given text to a given JSP saved in a given web path (relative to the base JSP path for the application server).
 java.lang.String getLocaleId()
          Obtain any extra information passed on the call to establish the session.
 java.lang.String getRequiredHtmlFields()
          Returns a string containing the HTML for all of the HTML Client required fields using the current processor name gotten from the table of stored processors.
 java.lang.String getRequiredHtmlFields(java.lang.String parentCtx, java.lang.String opName)
          Returns a string containing the HTML for all of the HTML Client required fields using the passed parameters to fill in the user specifiable information.
 java.lang.String getRequiredHtmlFieldsForGETMethod()
          Returns a string containing the HTML for all of the HTML Client required fields using the current processor name gotten from the table of stored processors.
 java.lang.String getRequiredHtmlFieldsForGETMethod(java.lang.String parentCtx, java.lang.String opName)
          Returns a string containing the HTML for all of the HTML Client required fields using the passed parameters to fill in the user specifiable information.
 Context getSessionContext()
          Return the session context for the page which initialized this bean.
 DataElement getSessionElement(java.lang.String name)
          Returns the named data element from the session context.
 java.lang.String getSessionId()
          Returns the current session identifier string "as-is".
 java.lang.String getSessionIdHtmlField()
          Returns the current session identifier string as an HTML hidden field.
 java.lang.String getSessionIdParameter()
          Returns the current session identifier string as a URL parameter.
 java.lang.String getSessionStringValue(java.lang.String name)
          Returns the specified value from the session context as a string.
 java.lang.Object getSessionValue(java.lang.String name)
          Returns the named value from the session context in its natural format.
 java.lang.String getStringValue(java.lang.String name)
          Returns the specified value from the operation context as a string.
protected  java.lang.String getStringValue(java.lang.String name, boolean useSess)
          Deprecated. This method will be removed in a future version of this API.
 java.lang.String[] getValidationErrorList()
          Returns all validation errors in a single list array.
 java.lang.Object getValue(java.lang.String name)
          Returns the named value from the operation context in its natural format.
protected  java.lang.Object getValue(java.lang.String name, boolean useSess)
          Deprecated. This method will be removed in a future version of this API.
 void initialize(javax.servlet.http.HttpServletRequest request)
          The HttpServletRequest is supposed to have references to the operation context and exceptions placed by the framework during handling of the request.
 boolean isFieldHidden(java.lang.String name)
          Returns the "hidden" status of the named field in the context.
 boolean isFieldInError(java.lang.String name)
          Returns the error status of the named field in the context.
 boolean isFieldMandatory(java.lang.String name)
          Returns the "input mandatory" status of the named field in the context.
 boolean isFieldReadOnly(java.lang.String name)
          Returns the "read only" status of the named field in the context.
 void setErrorDecorationPrefix(java.lang.String pfx)
          Sets up the error decorator prefix.
 void setErrorDecorationSuffix(java.lang.String sfx)
          Sets up the error decorator suffix.
 void setErrorMarker(java.lang.String newmarker)
          Sets up the error marker value.
protected  void setException(DSEException newException)
          If the framework placed an exception in the HttpServletRequest with key name dseexception, then it can be saved here when the bean is initialized.
protected  void setJspFormatError(java.lang.Exception xcp, java.lang.String name)
          Updates the JspFormatErrorList with information about the error occurred.
protected  void setJspFormatError(java.lang.Exception xcp, java.lang.String name, boolean useSess)
          Deprecated. This method will be removed in a future version of this API.
protected  void setJspFormatError(java.lang.String text)
          Updates the JspFormatErrorList with information about the error occurred.
protected  void setOperationAndSessionContext(javax.servlet.http.HttpServletRequest req)
          Save the operation context, and use it to obtain the session context, which is saved as well.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

operationContext

protected Context operationContext
The operation context.

sessionContext

protected Context sessionContext
The session context.

dseexception

protected DSEException dseexception
The current operation exception

baseWebPath

protected java.lang.String baseWebPath
The base web path string

extraPathInfo

protected java.lang.String extraPathInfo
The locale (extra path) string.

sessionID

protected java.lang.String sessionID
The session id string

errorMarker

protected java.lang.String errorMarker
The error marker value

errorPrefix

protected java.lang.String errorPrefix
The error decorator "prefix" value

errorSuffix

protected java.lang.String errorSuffix
The error decorator "suffix" value

errsVal

protected java.lang.String[] errsVal
The validation errors list

errsXVal

protected java.lang.String[] errsXVal
The cross-validation errors list

errsJsp

protected Vector errsJsp
The JSP format errors list

pageId

protected java.lang.String pageId
The pageId for the displaying page
Constructor Detail

DSEJspContextServices

public DSEJspContextServices()
DSEJspContextServices default constructor.
Method Detail

asDouble

public double asDouble(java.lang.String strval)
Useful service for converting a String into it's equivalent double value.
Returns:
double - The converted double value.

asFloat

public float asFloat(java.lang.String strval)
Useful service for converting a String into it's equivalent float value.
Returns:
float - The converted float value.

asInt

public int asInt(java.lang.String strval)
Useful service for converting a String into it's equivalent integer value.
Returns:
int - The converted int value.

asLong

public long asLong(java.lang.String strval)
Useful service for converting a String into it's equivalent long value.
Returns:
long - The converted long value.

getBaseWebPath

public java.lang.String getBaseWebPath()
Obtain the relative path for jsp resources.

Relative to the web app server web path

Specified by:
getBaseWebPath in interface JspContextServices
Returns:
String - The base web path value.

getContext

public Context getContext()
Get the operation context for the page which initialized this bean.
Specified by:
getContext in interface JspContextServices
Returns:
Context - The operation context value.

getCrossValidationErrorList

public java.lang.String[] getCrossValidationErrorList()
Return the current list of cross validation errors.
Specified by:
getCrossValidationErrorList in interface JspContextServices
Returns:
String[] - The error list array value.

getElement

public DataElement getElement(java.lang.String name)
Returns the named data element from the operation context.

If the element is not present in the context, null is returned.

Specified by:
getElement in interface JspContextServices
Returns:
DataElement - The data element value.

getElement

protected DataElement getElement(java.lang.String name,
                                 boolean useSess)
Insert the method's description here.
Parameters:
name - java.lang.String
useSess - boolean
Returns:
com.ibm.dse.base.DataElement

getErrorPageHtml

public java.lang.String getErrorPageHtml(java.lang.String name)
Returns:
String - The error page html.

getException

public DSEException getException()
If the framework placed an exception in the HttpServletRequest with key name dseexception, then it can be saved here when the bean is initialized.
Specified by:
getException in interface JspContextServices
Returns:
DSEException - The exception value.

getExceptionMessage

public java.lang.String getExceptionMessage()
Return message text cooresponding to the current exception.
Specified by:
getExceptionMessage in interface JspContextServices
Returns:
String - The exception message.

getFieldErrorMarker

public java.lang.String getFieldErrorMarker(java.lang.String name)
Return the current error marker only if the given field is in error.

Returns a blank string if no error exists.

Specified by:
getFieldErrorMarker in interface JspContextServices
Returns:
String - The field error marker value.

getFieldLabel

public java.lang.String getFieldLabel(java.lang.String name)
Returns the label associated with the given field in the context.
Specified by:
getFieldLabel in interface JspContextServices
Returns:
String - The field label value.

getFieldValidationError

public java.lang.String getFieldValidationError(java.lang.String name,
                                                int idx)
Return the field error message text at the specified index.

This method returns a blank string if the field has no errors.

Specified by:
getFieldValidationError in interface JspContextServices
Returns:
String - The validation error value.

getFieldValidationErrorDecorated

public java.lang.String getFieldValidationErrorDecorated(java.lang.String name,
                                                         int idx)
Return the field error message text at the specified index decorated with prefix and suffix HTML strings.

This method returns a blank string if the field has no errors.

Specified by:
getFieldValidationErrorDecorated in interface JspContextServices
Returns:
String - The decorated error value.

getFieldValidationErrorList

public java.lang.String[] getFieldValidationErrorList(java.lang.String name)
Retrieve the entire error list for the field.

An array of zero size is returned if there are no errors associated with the field.

Specified by:
getFieldValidationErrorList in interface JspContextServices
Returns:
String[] - The field error list.

getJspFormatErrorList

public java.lang.String[] getJspFormatErrorList()
Returns the list of Jsp Format Errors that were found during Jsp Processing.
Specified by:
getJspFormatErrorList in interface JspContextServices
Returns:
String[] - The format error list.

getLinkToPage

public java.lang.String getLinkToPage(java.lang.String webPath,
                                      java.lang.String pageName,
                                      java.lang.String linkText)
Emit the Html to the JspWriter stream to create a link with given text to a given JSP saved in a given web path (relative to the base JSP path for the application server). The link will include the session id using URL rewriting.
Specified by:
getLinkToPage in interface JspContextServices
Returns:
String - The link html.

getLocaleId

public java.lang.String getLocaleId()
Obtain any extra information passed on the call to establish the session. For example, if the URL was invoked as:
http://.../CSEstablishSessionServlet/en
then the extra path info is the string en.
Specified by:
getLocaleId in interface JspContextServices
Returns:
String - The extra path info.

getRequiredHtmlFields

public java.lang.String getRequiredHtmlFields()
Returns a string containing the HTML for all of the HTML Client required fields using the current processor name gotten from the table of stored processors.
Specified by:
getRequiredHtmlFields in interface JspContextServices
Returns:
String - The required fields html.

getRequiredHtmlFields

public java.lang.String getRequiredHtmlFields(java.lang.String parentCtx,
                                              java.lang.String opName)
Returns a string containing the HTML for all of the HTML Client required fields using the passed parameters to fill in the user specifiable information. If no opName is specified, assume that this page is being displayed within a processor flow, so the processor name is got from the table of stored processors.
Specified by:
getRequiredHtmlFields in interface JspContextServices
Parameters:
parentctx - java.lang.String
opname - java.lang.String
Returns:
String - The required fields html.

getRequiredHtmlFieldsForGETMethod

public java.lang.String getRequiredHtmlFieldsForGETMethod()
Returns a string containing the HTML for all of the HTML Client required fields using the current processor name gotten from the table of stored processors. The returned String is for use as part of an URL. The format is the needed to be sent via the GET method: param1=value1¶m2=value2&...¶mN=valueN
Specified by:
getRequiredHtmlFieldsForGETMethod in interface JspContextServices
Returns:
String - The required fields html in the format needed to send using the GET method.

getRequiredHtmlFieldsForGETMethod

public java.lang.String getRequiredHtmlFieldsForGETMethod(java.lang.String parentCtx,
                                                          java.lang.String opName)
Returns a string containing the HTML for all of the HTML Client required fields using the passed parameters to fill in the user specifiable information. If no opName is specified, assume that this page is being displayed within a processor flow, so the processor name is got from the table of stored processors. The returned String is for use as part of an URL. The format is the needed to be sent via the GET method: param1=value1¶m2=value2&...¶mN=valueN
Specified by:
getRequiredHtmlFieldsForGETMethod in interface JspContextServices
Parameters:
parentctx - java.lang.String
opname - java.lang.String
Returns:
String - The required fields html in the format needed to send using the GET method.

getSessionContext

public Context getSessionContext()
Return the session context for the page which initialized this bean.
Returns:
Context - The session context value.

getSessionElement

public DataElement getSessionElement(java.lang.String name)
Returns the named data element from the session context.

If the element is not present in the context, null is returned.

Returns:
DataElement - The data element value.

getSessionId

public java.lang.String getSessionId()
Returns the current session identifier string "as-is".
Specified by:
getSessionId in interface JspContextServices
Returns:
String - The session id value.

getSessionIdHtmlField

public java.lang.String getSessionIdHtmlField()
Returns the current session identifier string as an HTML hidden field.
Specified by:
getSessionIdHtmlField in interface JspContextServices
Returns:
String - The session id field html.

getSessionIdParameter

public java.lang.String getSessionIdParameter()
Returns the current session identifier string as a URL parameter.
Specified by:
getSessionIdParameter in interface JspContextServices
Returns:
String - The session id parameter.

getSessionStringValue

public java.lang.String getSessionStringValue(java.lang.String name)
Returns the specified value from the session context as a string.

Handles exceptions by returning a null string value.

Returns:
String - The session string value.

getSessionValue

public java.lang.Object getSessionValue(java.lang.String name)
Returns the named value from the session context in its natural format.

If the element is not present in the context, null is returned.

Returns:
String - The session value.

getStringValue

public java.lang.String getStringValue(java.lang.String name)
Returns the specified value from the operation context as a string. If the element is not present in the operation context it is looked for in the session context.

Handles exceptions by returning a null string value.

Specified by:
getStringValue in interface JspContextServices
Returns:
String - The string value.

getStringValue

protected java.lang.String getStringValue(java.lang.String name,
                                          boolean useSess)
Deprecated. This method will be removed in a future version of this API.


getValidationErrorList

public java.lang.String[] getValidationErrorList()
Returns all validation errors in a single list array.
Specified by:
getValidationErrorList in interface JspContextServices
Returns:
String[] - The validation error list.

getValue

public java.lang.Object getValue(java.lang.String name)
Returns the named value from the operation context in its natural format. If the element is not present in the operation context, it is looked for in the session context.

If the element is not present in the context hierarchy, null is returned.

Specified by:
getValue in interface JspContextServices
Returns:
Object - The context value.

getValue

protected java.lang.Object getValue(java.lang.String name,
                                    boolean useSess)
Deprecated. This method will be removed in a future version of this API.


initialize

public void initialize(javax.servlet.http.HttpServletRequest request)
                throws DSEException
The HttpServletRequest is supposed to have references to the operation context and exceptions placed by the framework during handling of the request. Use this information to initialize the bean for use by the JSP that includes it.
Parameters:
request - javax.servlet.http.HttpServletRequest

isFieldHidden

public boolean isFieldHidden(java.lang.String name)
Returns the "hidden" status of the named field in the context.
Specified by:
isFieldHidden in interface JspContextServices
Returns:
boolean - The field hidden indicator.

isFieldInError

public boolean isFieldInError(java.lang.String name)
Returns the error status of the named field in the context.
Specified by:
isFieldInError in interface JspContextServices
Returns:
boolean - The field in error indicator.

isFieldMandatory

public boolean isFieldMandatory(java.lang.String name)
Returns the "input mandatory" status of the named field in the context.
Specified by:
isFieldMandatory in interface JspContextServices
Returns:
boolean - The field "is mandatory" indicator.

isFieldReadOnly

public boolean isFieldReadOnly(java.lang.String name)
Returns the "read only" status of the named field in the context.
Specified by:
isFieldReadOnly in interface JspContextServices
Returns:
boolean - The field "read only" indicator.

setErrorDecorationPrefix

public void setErrorDecorationPrefix(java.lang.String pfx)
Sets up the error decorator prefix.

This prefix is prepended to any error information returned in a "decorated" error string.

Specified by:
setErrorDecorationPrefix in interface JspContextServices
Returns:
void - Nothing

setErrorDecorationSuffix

public void setErrorDecorationSuffix(java.lang.String sfx)
Sets up the error decorator suffix.

This suffix is appended to any error information returned in a "decorated" error string.

Specified by:
setErrorDecorationSuffix in interface JspContextServices
Returns:
void - Nothing

setErrorMarker

public void setErrorMarker(java.lang.String newmarker)
Sets up the error marker value.

This is the string that is returned by the "getFieldErrorMarker" method if the field is found to be in error.

Specified by:
setErrorMarker in interface JspContextServices
Returns:
void - Nothing

setException

protected void setException(DSEException newException)
If the framework placed an exception in the HttpServletRequest with key name dseexception, then it can be saved here when the bean is initialized.
Parameters:
newException - com.ibm.dse.base.DSEException

setJspFormatError

protected void setJspFormatError(java.lang.Exception xcp,
                                 java.lang.String name)
Updates the JspFormatErrorList with information about the error occurred.
Parameters:
text - java.lang.String

setJspFormatError

protected void setJspFormatError(java.lang.Exception xcp,
                                 java.lang.String name,
                                 boolean useSess)
Deprecated. This method will be removed in a future version of this API.


setJspFormatError

protected void setJspFormatError(java.lang.String text)
Updates the JspFormatErrorList with information about the error occurred.
Parameters:
text - java.lang.String

setOperationAndSessionContext

protected void setOperationAndSessionContext(javax.servlet.http.HttpServletRequest req)
                                      throws DSEException
Save the operation context, and use it to obtain the session context, which is saved as well.
Parameters:
newOperationContext - com.ibm.dse.base.Context