Class JKJspUtil

java.lang.Object
com.jk.web.servlets.JKJspUtil

@Named("jk") @Eager @ApplicationScoped public class JKJspUtil extends Object
This class provides utility methods for use within Jakarta Server Pages (JSP) in a Java application.
Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Constructor Summary

    Constructors
    Constructor
    Description
    This method constructs a new JKJspUtil.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    This method retrieves the current year.
    boolean
    exists(String fileName)
    This method checks if a file with the given fileName exists.
    This method retrieves the path of the request's URL.
    boolean
    This method checks if the user is accessing the application from a mobile device.
    list(int size)
    This method generates a list of integers from 0 to `size - 1`.
    static void
    main(String[] args)
    This main method demonstrate the live random value.
    This method reloads and returns a random value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JKJspUtil

      public JKJspUtil()
      This method constructs a new JKJspUtil.
  • Method Details

    • reloadRandom

      public String reloadRandom()
      This method reloads and returns a random value.
      Returns:
      a random value.
    • currentYear

      public int currentYear()
      This method retrieves the current year.
      Returns:
      the current year.
    • getPath

      public String getPath()
      This method retrieves the path of the request's URL.
      Returns:
      the path of the request's URL.
    • exists

      public boolean exists(String fileName)
      This method checks if a file with the given fileName exists.
      Parameters:
      fileName - Specifies the name of the file to check.
      Returns:
      true, if the file exists, false otherwise.
    • isMobile

      public boolean isMobile()
      This method checks if the user is accessing the application from a mobile device.
      Returns:
      true, if the request is from a mobile device, false otherwise.
    • main

      public static void main(String[] args)
      This main method demonstrate the live random value.
      Parameters:
      args - the command-line arguments.
    • list

      public List<Integer> list(int size)
      This method generates a list of integers from 0 to `size - 1`.
      Parameters:
      size - Specifies the size of the list.
      Returns:
      a list of integers.