• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you. I wasn't passing the jsp through the controller and that was the problem.

-Joe
 
Hey! You're stepping on my hand! Help me tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic