File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Dynamic generation of jsp dropdown items from database based on another drop down Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Dynamic generation of jsp dropdown items from database based on another drop down" Watch "Dynamic generation of jsp dropdown items from database based on another drop down" New topic
Author

Dynamic generation of jsp dropdown items from database based on another drop down

Dhamayanthi Karuppanan
Ranch Hand

Joined: Oct 20, 2009
Posts: 31
I have gone through many threads but still I'm not very clear how to do this.

In a JSP page, I need to show 5 different drop down boxes and first drop down box has pre populated options in it. I need to show the second drop down options based on my first selection ie, once the user select the item in drop down, the second drop down has to get data from database based on the selection user made. And same continues for remaining drop downs.

We are not using ajax or jquery here. Javascript can be used.
Please share your ideas. Thanks for your time.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60041
    
  65

Dhamayanthi Karuppanan wrote:We are not using ajax or jquery here. Javascript can be used.

Well, first of all that doesn't make much sense. Ajax is JavaScript, and jQuery is a JavaScript library.

Without Ajax, you're not going to able to do this (unless you submit and repaint the whole page every time a choice is made as if the page were being written in 2001).

So what's it going to be? Ajax? Or 2001?

And if you are going to do Ajax, it only makes sense to use jQuery or one of the other libraries. Doing Ajax otherwise is simply too difficult and error-prone.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dhamayanthi Karuppanan
Ranch Hand

Joined: Oct 20, 2009
Posts: 31
Ok, well, I want my page to be up to date. If I need to go with JQuery and Ajax, what are the things I should include to my server to get work done, like libraries, .jar files and where do i need to place? I tried place JSTL lib and still I have not succeded :-(

I have done little ajax, so going forward I hope I can do it. But could you please share me design ideas / steps to solve my issue, like step 1 - define <select> assign ajax call kinda.

sorry, if have asked something silly. I just want to start this and implement on my page by learning ajzx n jquery.

Thanks.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4419
    
    5

Dhamayanthi,

It's not that the question is silly, it's just that sometimes it bugs us that it appears the person asking the question has not made any effort to do some homework before they ask questions. That's kind of, well, to put it bluntly, lazy. We don't suffer laziness around here very well. All the moderators here are volunteers. We don't get paid to do this. We are on our own coin and we do it because we like doing it (most of the time).

At any rate, you don't need any JAR files to take advantage of JQuery and Ajax. JQuery and JavaScript libraries like it are just .js files which you reference from HTML/JSP. See this tutorial: http://www.youtube.com/watch?v=NPW6PqmE4yg


Junilu - [How to Ask Questions] [How to Answer Questions]
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4419
    
    5

Dhamayanthi Karuppanan wrote:I tried place JSTL lib and still I have not succeded


JSTL is a server-side technology and has no relation whatsoever with JavaScript libraries and Ajax, which are client-side technologies. Have you tried searching for JSTL tutorials vs Ajax and JQuery tutorials
Dhamayanthi Karuppanan
Ranch Hand

Joined: Oct 20, 2009
Posts: 31
Thank you very much for the link and the details you shared. I understand that every one is here for helping others in terms of technical guidance towards solution and the same way I have asked expecting others to help me. As I'm new to Ajax and jQuery, I wanted some key points / tutorials where I can directly jump and start, rather than spending whole day in browsing to find helping tutorials for what i wanted.

Thank you so much for your help.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60041
    
  65

Get the JSTL working first. See the JspFaq for tips on why it might not be working.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamic generation of jsp dropdown items from database based on another drop down
 
Similar Threads
dynamic help
How to code the Country and State Drop down buttons in jsp
Dynamic Drop Down Lists.
Displaying value second drop down based on the value selected in the first drop down
Dropdown values for JSP