Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Dhamayanthi Karuppanan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dhamayanthi Karuppanan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7480
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 Lacar
Bartender
Posts: 7480
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Get the JSTL working first. See the JspFaq for tips on why it might not be working.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic