Package openbook.util

Class JSPUtility


  • public class JSPUtility
    extends java.lang.Object
    A set of static utilities used by the Java Server Pages.
    Author:
    Pinaki Poddar
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.text.DecimalFormat currencyFormatter
      Converts the given number in currency format.
      static java.text.DateFormat dateFormatter  
      static java.lang.String SRC_ROOT  
    • Constructor Summary

      Constructors 
      Constructor Description
      JSPUtility()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String encodeURL​(java.lang.String page, java.lang.Object... params)
      Encodes parameter key-values in a URL.
      static java.lang.String format​(java.lang.Number price)  
      static java.lang.String format​(java.util.Date date)  
      static java.lang.String getURL​(java.lang.String className, java.lang.String anchor)  
      static java.lang.Double toDouble​(java.lang.String v)
      Converts the given String to a double.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • currencyFormatter

        public static final java.text.DecimalFormat currencyFormatter
        Converts the given number in currency format.
      • dateFormatter

        public static final java.text.DateFormat dateFormatter
    • Constructor Detail

      • JSPUtility

        public JSPUtility()
    • Method Detail

      • format

        public static java.lang.String format​(java.lang.Number price)
      • format

        public static java.lang.String format​(java.util.Date date)
      • toDouble

        public static java.lang.Double toDouble​(java.lang.String v)
        Converts the given String to a double. Return null if the String is null or non-numeric.
      • encodeURL

        public static java.lang.String encodeURL​(java.lang.String page,
                                                 java.lang.Object... params)
        Encodes parameter key-values in a URL.
        Parameters:
        page - the base page
        params - key-value pairs of parameters passed in to the page URL. null or empty argument is allowed.
        Returns:
        a URL encoded string
      • getURL

        public static java.lang.String getURL​(java.lang.String className,
                                              java.lang.String anchor)