Listener to Load up values in the context

Posted on 2006-05-22
Medium Priority
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
  • 3
LVL 16

Expert Comment

ID: 16735563

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

suprapto45 earned 2000 total points
ID: 16735696
Sorry, it was ServletContextListener instead of ContextListener

LVL 16

Expert Comment

ID: 16739100

Glad I could help


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
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…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

807 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