Class 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 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 object
        pname - String name of the property
        def - 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 object
        pname - 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 Throwable
        Return a boolean property value or the default
        Parameters:
        msg - MessageResources object
        pname - String name of the property
        def - 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 Throwable
        Return an int property value or the default
        Parameters:
        msg - MessageResources object
        pname - String name of the property
        def - 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 messages
        caller - Used for log identification
        request - Needed to locate session
        messages - MessageResources object for creating new object
        errorObjAttrName - name of session attribute
        errProp - name of exception message property
        noActionErrors - true/false
        clear - 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 session
        errorObjAttrName - 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 messages
        caller - Used for log identification
        request - Needed to locate session
        messages - MessageResources object for creating new object
        messageObjAttrName - name of session attribute
        errProp - name of exception message property
        clear - 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 session
        messageObjAttrName - name of session attribute
        Returns:
        MessageEmit null on none found