Listener to Load up values in the context

Posted on 2006-05-22
Last Modified: 2010-04-17
I am new to JSP (actually learning) , and I am building a web application where a form has a series of check boxes whose values are dynamically loaded from the database .

Since these are loaded dynamically before the application starts I was wondering whether I should use a Listener Class that loads the requsite fields onloading and makes it available for the Context.

I was wondering

          1.If this is the way it is to be done
          2.If so could you give me some examples or pointers to this ....

Please Note : I am not using Struts or any other framework simply becase I want to learn it the hard way (basics without a framework ) then move on to a framework where the details are not hidden

Question by:micro_learner
    LVL 16

    Expert Comment


    You do not need any Listener for that. What you can do is that to call your Servlet first before rendering your JSP. Then the servlet will redirect you to the JSP where those dynamic checkboxes are going to be displayed.

    Just for your information, if you want to load something when your web application is started, Yes, you can do that. Please have a look at the ContextListener and you need to register this Listener to your web.xml. But for your case, I do not think that ContextListener is required.

    LVL 16

    Accepted Solution

    Sorry, it was ServletContextListener instead of ContextListener

    LVL 16

    Expert Comment


    Glad I could help


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Javascript: Crash Course

    Javascript is not only emerging as the most important language to know, it's flexibility is unique. With Javascript being deployed on the web, mobile and even the desktop this is the one language that all technologists need to know.

    Suggested Solutions

    Title # Comments Views Activity
    Excel object stays open 19 56
    countHi challenge 25 60
    Specific format 21 105
    VB 6.0 printer how to align 6 36
    A short article about a problem I had getting the GPS LocationListener working.
    A short article about problems I had with the new location API and permissions in Marshmallow
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now