Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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

drop down menu

 
Anil Dubey
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone.

I am trying to create a drop down menu using JSP. The content of the menu should be fetched from a column in the table. For example;

Table name: week
Column name: days
Days has (mon, tue, wed, thurs, fri, sat, sun)

now i want to make a drop down such that it would fetch from table week and put in the days as the content of the drop down.
Any suggestions or help will be much appreciated.

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you got so far? DO you have the HTML and JavaScript that defines the menu designed? Until you know what it is you want to build, it's not time to think about the JSP to build it.
 
Dawn Charangat
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These tables, are they DB tables or html tables?
 
Anil Dubey
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The table exist in the Oracle sql server.
Also this is a small part of a complex issue.
----
onclick of a button i have a window pop up and this window should have the drop down menu.
based on the user selection of the day i am running a stored procedure.

Thanks
 
Dawn Charangat
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That looks pretty simple [or is it just me] - just some plain javascript should do the trick.

On click of the button, make sure you have an attribute "target=_blank" so that the response opens in a new window. Rest is just usual server side code... you fetch the data, and populate it in whatever UI component you need it to.
 
Paul Clapham
Sheriff
Pie
Posts: 20758
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. So first design the HTML which is going to contain that drop-down. You know what HTML element you're going to use, right? (If not then that's the first thing to find out.) Write out an example with a couple of entries in it.

Once you have that, then you know what your JSP should be generating. But it needs some input to work from. So you should have a servlet that extracts the data required to produce the drop-down and puts it in a list of objects. Add that list to the request scope and forward to the JSP. The JSP will contain some JSTL code to produce the drop-down from that list.

That's just a general description. But hopefully you can see that there's several different parts of the design. Don't try to do them all in one lump, do them separately. It may happen that you have to redo one part of your design when you find in some other part that there's something missing, but that's normal in the design process.
 
Anil Dubey
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys..

I am going to attempt all those and let you all know how it went.

Thanks for all the suggestions
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic