Package org.bgerp.app.servlet.jsp

# Class UtilFunction

java.lang.Object
org.bgerp.app.servlet.jsp.UtilFunction

public class UtilFunction extends Object
Functions defined in util.tld JSP library.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UtilFunction()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `actionUrl(String action)`
  Action call URL like `actionPath.do?method=methodName` out of semicolon separated action class and method `actionId:methodName`
  `static String`
  `checked(Boolean object)`
  `static String`
  `checked(Object collection, Object object)`
  `static String`
  `docUrl(String url)`
  Documentation URL for the currently running app version
  `static String`
  `fileNameWithLastModTime(String path)`
  `static Integer`
  `getInt(Object value)`
  `static String`
  `htmlEncode(String value)`
  Replaces some HTML symbols.
  `static String`
  `httpLinksToHtml(String value)`
  Recognizes and replaces HTTP links to HTML code.
  `static Object`
  `newInstance(String className)`
  Non-varargs version of `newInstance(String, Object...)` for using as a JSP taglib method.
  `static Object`
  `newInstance(String className, Object arg0)`
  Non-varargs version of `newInstance(String, Object...)` for using as a JSP taglib method.
  `static Object`
  `newInstance(String className, Object... args)`
  Creates a new instance of a Java class.
  `static Object`
  `newInstance(String className, Object arg0, Object arg1)`
  Non-varargs version of `newInstance(String, Object...)` for using as a JSP taglib method.
  `static Object`
  `newInstance(String className, Object arg0, Object arg1, Object arg2)`
  Non-varargs version of `newInstance(String, Object...)` for using as a JSP taglib method.
  `static <T extends IdTitle>
  String`
  `objectTitleList(List<T> fullList, Set<Integer> selectedIds)`
  Deprecated.
  `static String`
  `quotEscape(String value)`
  Escapes double quotes, used for preparation JS strings in JSPs.
  `static String`
  `selected(Boolean object)`
  `static String`
  `selected(Object collection, Object object)`
  `static final String`
  `toString(Collection<?> valuesList)`
  Deprecated.
  `static String`
  `truncateHtml(String s, Integer limit)`
  Truncates a string with HTML markup to a maximal length without breaking tags.
  `static String`
  `uiid()`
  `static String`
  `urlEncode(String value)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### UtilFunction

    public UtilFunction()

- ## Method Details

  - ### newInstance

    public static Object newInstance(String className, Object... args) throws Exception
    Creates a new instance of a Java class. Generic method with varargs argument, can't be called from JSP.
    Parameters:
      `className` - the class name.
      `args` - constructor arguments.
    Returns:
    Throws:
      `Exception`

  - ### newInstance

    public static Object newInstance(String className) throws Exception
    Non-varargs version of `newInstance(String, Object...)` for using as a JSP taglib method.
    Throws:
      `Exception`

  - ### newInstance

    public static Object newInstance(String className, Object arg0) throws Exception
    Non-varargs version of `newInstance(String, Object...)` for using as a JSP taglib method.
    Throws:
      `Exception`

  - ### newInstance

    public static Object newInstance(String className, Object arg0, Object arg1) throws Exception
    Non-varargs version of `newInstance(String, Object...)` for using as a JSP taglib method.
    Throws:
      `Exception`

  - ### newInstance

    public static Object newInstance(String className, Object arg0, Object arg1, Object arg2) throws Exception
    Non-varargs version of `newInstance(String, Object...)` for using as a JSP taglib method.
    Throws:
      `Exception`

  - ### checked

    public static String checked(Object collection, Object object)
    See Also:
      - invalid reference

            function checkedFromCollection.

  - ### checked

    public static String checked(Boolean object)
    See Also:
      - invalid reference

            function checkedFromBool.

  - ### selected

    public static String selected(Object collection, Object object)
    See Also:
      - invalid reference

            function selectedFromCollection.

  - ### selected

    public static String selected(Boolean object)
    See Also:
      - invalid reference

            function checkedFromBool.

  - ### getInt

    public static Integer getInt(Object value)
    See Also:
      - invalid reference

            function int.

  - ### uiid

    public static String uiid()
    Returns:
      an unique identifier for HTML nodes.

  - ### urlEncode

    public static String urlEncode(String value) throws UnsupportedEncodingException
    Throws:
      `UnsupportedEncodingException`

  - ### htmlEncode

    public static String htmlEncode(String value)
    Replaces some HTML symbols.

    `<` to `&amp;lt;`

    `>` to `&amp;gt;`

    `\n` to `&lt;br/>`

    `\t` to 4 whitespaces

    Parameters:
      `value` - input value.
    Returns:
      string with replacements.

  - ### httpLinksToHtml

    public static String httpLinksToHtml(String value)
    Recognizes and replaces HTTP links to HTML code. http://blog.codinghorror.com/the-problem-with-urls/
    Parameters:
      `value` -
    Returns:

  - ### quotEscape

    public static String quotEscape(String value)
    Escapes double quotes, used for preparation JS strings in JSPs.
    Parameters:
      `value` -
    Returns:

  - ### truncateHtml

    public static String truncateHtml(String s, Integer limit)
    Truncates a string with HTML markup to a maximal length without breaking tags. Finds a first position after all tags were closed, so the resulting length may be more than max.
    Parameters:
      `s` - the initial string
      `limit` - maximal length
    Returns:

  - ### fileNameWithLastModTime

    public static String fileNameWithLastModTime(String path)

  - ### docUrl

    public static String docUrl(String url)
    Documentation URL for the currently running app version
    Parameters:
      `url` - the path from documentation's root, or absolute url starting from `http` (this case it wouldn't be changed)
    Returns:
      the absolute documentation URL

  - ### actionUrl

    public static String actionUrl(String action) throws javassist.NotFoundException
    Action call URL like `actionPath.do?method=methodName` out of semicolon separated action class and method `actionId:methodName`
    Parameters:
      `action` - the semicolon separated action class and method
    Returns:
      the URL
    Throws:
      `javassist.NotFoundException`

  - ### toString

    @Deprecated public static final String toString(Collection<?> valuesList)
    Deprecated.

  - ### objectTitleList

    @Deprecated public static <T extends IdTitle> String objectTitleList(List<T> fullList, Set<Integer> selectedIds)
    Deprecated.