Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create a drop down on pageload with data from a db

 
Joe Matt
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am running a web application on tomcat 6.0 using jsp and mvc controllers.I have a jsp page which has a drop down list. This is the first/home page of the application. The drop down should be populated with data from a database when the page is first loaded. I was hoping to get the data as an object in the controller and use the jstl tags in the jsp page to create the drop down list
I am using mvc but no frameworks like spring or struts. Is there any methods similar to the refrencedata method in spring to prepopulate the form with data from backend? I am confused as how to trigger the controller to load the data from the db since there are no actions performed on the page when the page gets loaded first.

Thanks
-Joe
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not understanding the issue. If the page needs the data, the page controller fetches it from the model. Why does there need to be "page activity"?

Or, are you not using a page controller for your "home" page? If not, why not?
 
Joe Matt
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you. I wasn't passing the jsp through the controller and that was the problem.

-Joe
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic