• 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

JavaScript in JSP

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Help me! I need to display the drop down menu dynamically through JSP in which the values/menu items are retriving through database. Each menu item is coming from database as a row element.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Find a dropdown menu and write out the JavaScript arrays from the jsp backend. not hard to do.

Eric
 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the best solution to this is to use AJAX.
It really helps to update your page without even refreshing the page.
call the Servlet from your JSP and the make the Servlet to return data as (text/xml) and update your DOM using the XML.

Thanks
Ramesh
 
Sheriff
Posts: 67746
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

the best solution to this is to use AJAX.



Stringly disagree. There is no need to wait until the page is loaded to set up the dropdown using Ajax. How convoluted!

Eric suggested the best solution: in your controller, gather the data required to populate the dropdown, send that data to the JSP, use JSTL to iterate over the data and emit the markup. Straight-forward and simple.
 
reply
    Bookmark Topic Watch Topic
  • New Topic