|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdsto.dfc.servlets.ServletSupport
public final class ServletSupport
General servlet support routines.
| Method Summary | |
|---|---|
static void |
clearError(javax.servlet.http.HttpServletRequest request)
Clear the current error (if any) for the session. |
static String |
getError(javax.servlet.http.HttpServletRequest request)
Get the current error (if any) for the session. |
static String |
getNonEmptyParam(javax.servlet.ServletRequest request,
String param)
Get a non-empty parameter value. |
static String |
getOptionalNonEmptyParam(javax.servlet.ServletRequest request,
String param)
Get an optional non-empty parameter value. |
static String |
getParam(javax.servlet.ServletRequest request,
String param)
Get an a required parameter value. |
static int |
getParam(javax.servlet.ServletRequest request,
String name,
int defaultValue)
Shortcut to extract an integer parameter from a servlet request. |
static String |
getParam(javax.servlet.ServletRequest request,
String param,
String defaultValue)
|
static String |
htmlAttr(String attr,
Object value)
Generate a HTML attr="value" statement. |
static String |
htmlChecked(boolean checked)
Generate a HTML checked="true" if the parameter is true or
"" if not. |
static String |
htmlLink(String text,
String url)
Generate a HTML <a href="...">blah</a> value. |
static String |
htmlNameValue(String field,
IDataObject values)
Generate a HTML name="field" value="value" pair. |
static String |
htmlNameValue(String field,
Object value)
Generate a HTML name="field" value="value" pair. |
static String |
htmlValueAttr(Object value)
|
static void |
postError(javax.servlet.http.HttpServletRequest request,
String message)
Post an error by lodging it as the "error" attribute on the current session. |
static String |
toHTML(String string)
Escape a string for use in HTML. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static int getParam(javax.servlet.ServletRequest request,
String name,
int defaultValue)
request - The request.name - The parameter name.defaultValue - The value to return if name is not defined or invalid.
public static String getNonEmptyParam(javax.servlet.ServletRequest request,
String param)
throws MissingParameterException
request - The request.param - The parameter name.
MissingParameterException - if the parameter is either null or the
empty string.
public static String getOptionalNonEmptyParam(javax.servlet.ServletRequest request,
String param)
request - The request.param - The parameter name.
public static String getParam(javax.servlet.ServletRequest request,
String param)
throws MissingParameterException
request - The request.param - The parameter name.
MissingParameterException - if the parameter is not present.
public static String getParam(javax.servlet.ServletRequest request,
String param,
String defaultValue)
public static String htmlNameValue(String field,
IDataObject values)
field - The field name.values - The value set. The value is read using values.getValue
(field).
htmlNameValue(String, Object)
public static String htmlNameValue(String field,
Object value)
field - The field name.value - The value. If null, the value= part is left out.
public static String htmlValueAttr(Object value)
public static String htmlAttr(String attr,
Object value)
attr - The attribute name.value - The value. If null, "" is returned..
public static String htmlLink(String text,
String url)
text - The link text.url - The URL. May be null in which case just the text is returned.public static String htmlChecked(boolean checked)
checked="true" if the parameter is true or
"" if not.
public static String toHTML(String string)
string - The string to escape. May be null.
public static void postError(javax.servlet.http.HttpServletRequest request,
String message)
request - The request that the error happened in.message - The error message.getError(HttpServletRequest),
clearError(HttpServletRequest)public static String getError(javax.servlet.http.HttpServletRequest request)
request - The request that the error happened in.
postError(HttpServletRequest, String),
clearError(HttpServletRequest)public static void clearError(javax.servlet.http.HttpServletRequest request)
request - The request that the error happened in.postError(HttpServletRequest, String),
getError(HttpServletRequest)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||