EJB design: JSP

  1. JSP (3 messages)

    hello experts,

    I have one question regarding Application variables in jsp.
    How to use application variables. What is its scope.What r its advantages.

    thanx in advance

    Threaded Messages (3)

  2. JSP[ Go to top ]

    Application variables are simply Java objects, which are identified by their unique name (Just like session variables). Their scope is the entire web application, meaning once you have set then in the application, they will stay there until you remove them (or until the application teminates). An application, as defined by Sun, is "a collection of servlets and content installed under a specific subset of the server's URL namespace such as /catalog and possibly installed via a .war file".
    They are usefull for global variables that all your jsp's and servlets have to access, and are typically initialized when the application starts.
    An example for this might be a class which contains some application constants, which are read from a data source upon start up, and have to be accessed by servlets and jsp's. You use them like this:
    in jsp's: application.setAttribute("variableName", someObject)
    in servlets: getServletContext().setAttribute("variableName", someObject)
  3. JSP[ Go to top ]


    can u send me some more information on this.

  4. Hi i am dinesh[ Go to top ]

    well my question is How can we get the value in Servlet, which is set in jsp by using "application.setAttribute("anyvalue",anyvalue);"? i dont want any other alternative request.setAttribute object or use session.setAttribute in jsp instead of apllication.setAttribute.... I jst need a specific answer related to my question only.... thx