• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Cascading Dropdown List

 
Mellisa Thenu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I've been google-ing and searching for the answers to my problem but no luck so far.

I have a JSP application with MySQL database, and one of the form has cascading dropdown list. So here is how the page works. There are 2 dropdown list: Term List and Class List. When the page is loading, it will populate the term list from the database. Based on the user selection on the term, it will run the database query for the Class List to display a list of class under that selected term.

The dropdown list is working just fine. But after doing several selections, the page will just keep loading and the server just died.

Anybody has a suggestion of what could be the problem? Thank you so much for the help.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's occurring when the first selection is made? Is the secondary dropdown's data obtained via an Ajax call, or a full-page submission? In either case, what's the logic around it?

Please post the relevant code. Be sure to use UBB code tags to preserve its formatting.
 
Mellisa Thenu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the fast response. I am not using AJAX call, so it is a full-page submission. Here is the code for that:

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh my. I would be remiss if I didn't point out that putting Java code in JSP pages in this way -- especially JDBC code -- is considered an egregious violation of best practices.

Please describe the exact behavior you are seeing.
 
Mellisa Thenu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to JSP so I do not know the best practice for this.

The page will work just fine for the first or second time of selection. For example:

First attempt:
I select the term --> the Class list is populated correctly.

Second attempt:
I re-select the term --> the Class list is still populated correctly.

Usually, after the fourth or fifth attempt, the page will just keep loading and there is nothing I can do unless restarting the server.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there JavaScript code that you haven't shown us that controls the submission?
 
Mellisa Thenu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no JavaScript code for that.

After doing more research, I just changed the maxActive value for the database connection to 100 (it was 8 before), and now everything is working. I have done a lot of selection attempts and so far the site is still up.

My question now: is this just a temporary fix or not? Will this create another problem?

Thank you.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like that limit was causing an exception that was causing the issue. You might want to review your exception handling and logging to prevent a recurrence.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Going forward, I would also recommend becoming familiar with better ways to structure your code so that debugging such issues is much easier.

You my find this article a good place to start.
 
Mellisa Thenu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll take a look on that. Thank you so much for your help .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic