• 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

Dependent Combo Box

 
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Ranchers,

In my project, I need a depenedent combo box, I have got some inputs from some websites and i designed like this. The codes are given below





MySQL database details are here



The values are populating well and fine. In the code I have created arraylist in test2.jsp and is sending to country.jsp file. When it comes to country.jsp the values looks like this, when I select Kenya in the country.



Again when I, split it into two different arrays, i will get in first array
[001] and in second [Mombassa]

When I populate the value in the second combo box, I am getting the square brackets also.

Please help me to avoid the brackets.

Thanks in advance

Regards

Aravind Prasad
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where are the square brackets coming from? Database?

Eric
 
Aravind Prasad
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is not coming from the database, When we check the out.println of the Array list it is coming with that.

Please try to check this program, I provided and check it out.

Thanks/Regards
 
Aravind Prasad
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Ranchers,

I have removed the square brackets using substring and it is now working perfectly

Thank you for the help and support.

Regards

Aravind Prasad
 
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
Terminology correction: there is no such thing as a "combo box" on the web. Please read this for more information.
 
Greenhorn
Posts: 20
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for sharing this code. This code is truly a worth sharing here as I have searched a lot for this code. Can you please tell me how to remove those square brackets? As I am also trying to use your code, but couldn't figure out how to remove them. Please help me thanks.

Aravind Prasad wrote:Dear Ranchers,

I have removed the square brackets using substring and it is now working perfectly

Thank you for the help and support.

Regards

Aravind Prasad

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sanjeev Pk wrote:Thanks a lot for sharing this code. This code is truly a worth sharing here as I have searched a lot for this code. Can you please tell me how to remove those square brackets? As I am also trying to use your code, but couldn't figure out how to remove them. Please help me thanks.

Aravind Prasad wrote:Dear Ranchers,

I have removed the square brackets using substring and it is now working perfectly

Thank you for the help and support.

Regards

Aravind Prasad



sanjeev have done something like


so add your list to response by removing the brackets by substring method
 
Sanjeev P Kulkarni
Greenhorn
Posts: 20
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

subhash kumar wrote:

Sanjeev Pk wrote:Thanks a lot for sharing this code. This code is truly a worth sharing here as I have searched a lot for this code. Can you please tell me how to remove those square brackets? As I am also trying to use your code, but couldn't figure out how to remove them. Please help me thanks.

Aravind Prasad wrote:Dear Ranchers,

I have removed the square brackets using substring and it is now working perfectly

Thank you for the help and support.

Regards

Aravind Prasad



sanjeev have done something like


so add your list to response by removing the brackets by substring method



Thanks a million Sir. This code is one of the valuable and most widely used. Thank you once again for helping me...
 
Sanjeev P Kulkarni
Greenhorn
Posts: 20
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sanjeev P Kulkarni wrote:

subhash kumar wrote:

Sanjeev Pk wrote:Thanks a lot for sharing this code. This code is truly a worth sharing here as I have searched a lot for this code. Can you please tell me how to remove those square brackets? As I am also trying to use your code, but couldn't figure out how to remove them. Please help me thanks.

Aravind Prasad wrote:Dear Ranchers,

I have removed the square brackets using substring and it is now working perfectly

Thank you for the help and support.

Regards

Aravind Prasad



sanjeev have done something like


so add your list to response by removing the brackets by substring method



Thanks a million Sir. This code is one of the valuable and most widely used. Thank you once again for helping me...



Just a small doubt, How to get the value of a port selected in your country.jsp??? because I need to save both the combo box values into the database. I tried document.form.state.value also tried printing document.frmVal.stateId.options.add(optn); but nothing is working out.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic