Package org.bedework.util.struts
Class StrutsUtil
- java.lang.Object
-
- org.bedework.util.servlet.HttpServletUtils
-
- org.bedework.util.struts.StrutsUtil
-
public class StrutsUtil extends HttpServletUtils
This class provides some convenience methods for use by ActionForm objects. It shoudl really be called StrutsUtil- Author:
- Mike Douglass
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleangetBoolProperty(org.apache.struts.util.MessageResources msg, String pname, boolean def)Return a boolean property value or the defaultstatic MessageEmitgetErrorObj(String id, Object caller, javax.servlet.http.HttpServletRequest request, org.apache.struts.util.MessageResources messages, String errorObjAttrName, String errProp, boolean noActionErrors, boolean clear)Get the error object.static MessageEmitgetErrorObj(javax.servlet.http.HttpServletRequest request, String errorObjAttrName)Get the existing error object from the session or null.static intgetIntProperty(org.apache.struts.util.MessageResources msg, String pname, int def)Return an int property value or the defaultstatic MessageEmitgetMessageObj(String id, Object caller, javax.servlet.http.HttpServletRequest request, org.apache.struts.util.MessageResources messages, String messageObjAttrName, String errProp, boolean clear)Get the message object.static MessageEmitgetMessageObj(javax.servlet.http.HttpServletRequest request, String messageObjAttrName)Get the existing message object from the session or null.static StringgetProperty(org.apache.struts.util.MessageResources msg, String pname, String def)Return a property value or the defaultstatic StringgetReqProperty(org.apache.struts.util.MessageResources msg, String pname)Return a required property value-
Methods inherited from class org.bedework.util.servlet.HttpServletUtils
dumpHeaders, getBrowserType, getContext, getHeaders, getLocales, getReqLine, getUrl, getURLPrefix, getURLshp
-
-
-
-
Method Detail
-
getProperty
public static String getProperty(org.apache.struts.util.MessageResources msg, String pname, String def) throws Throwable
Return a property value or the default- Parameters:
msg- MessageResources objectpname- String name of the propertydef- String default value- Returns:
- String property value or default (may be null)
- Throws:
Throwable- on error
-
getReqProperty
public static String getReqProperty(org.apache.struts.util.MessageResources msg, String pname) throws Throwable
Return a required property value- Parameters:
msg- MessageResources objectpname- name of the property- Returns:
- String property value
- Throws:
Throwable- on error
-
getBoolProperty
public static boolean getBoolProperty(org.apache.struts.util.MessageResources msg, String pname, boolean def) throws ThrowableReturn a boolean property value or the default- Parameters:
msg- MessageResources objectpname- String name of the propertydef- boolean default value- Returns:
- boolean property value or default
- Throws:
Throwable- on error
-
getIntProperty
public static int getIntProperty(org.apache.struts.util.MessageResources msg, String pname, int def) throws ThrowableReturn an int property value or the default- Parameters:
msg- MessageResources objectpname- String name of the propertydef- int default value- Returns:
- int property value or default
- Throws:
Throwable- on error
-
getErrorObj
public static MessageEmit getErrorObj(String id, Object caller, javax.servlet.http.HttpServletRequest request, org.apache.struts.util.MessageResources messages, String errorObjAttrName, String errProp, boolean noActionErrors, boolean clear)
Get the error object. If we haven't already got one and getErrorObjAttrName returns non-null create one and implant it in the session.- Parameters:
id- Identifying string for messagescaller- Used for log identificationrequest- Needed to locate sessionmessages- MessageResources object for creating new objecterrorObjAttrName- name of session attributeerrProp- name of exception message propertynoActionErrors- true/falseclear- list- Returns:
- MessageEmit null on failure
-
getErrorObj
public static MessageEmit getErrorObj(javax.servlet.http.HttpServletRequest request, String errorObjAttrName)
Get the existing error object from the session or null.- Parameters:
request- Needed to locate sessionerrorObjAttrName- name of session attribute- Returns:
- MessageEmit null on none found
-
getMessageObj
public static MessageEmit getMessageObj(String id, Object caller, javax.servlet.http.HttpServletRequest request, org.apache.struts.util.MessageResources messages, String messageObjAttrName, String errProp, boolean clear)
Get the message object. If we haven't already got one and getMessageObjAttrName returns non-null create one and implant it in the session.- Parameters:
id- Identifying string for messagescaller- Used for log identificationrequest- Needed to locate sessionmessages- MessageResources object for creating new objectmessageObjAttrName- name of session attributeerrProp- name of exception message propertyclear- the list- Returns:
- MessageEmit null on failure
-
getMessageObj
public static MessageEmit getMessageObj(javax.servlet.http.HttpServletRequest request, String messageObjAttrName)
Get the existing message object from the session or null.- Parameters:
request- Needed to locate sessionmessageObjAttrName- name of session attribute- Returns:
- MessageEmit null on none found
-
-