Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: %20f problem

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default %20f problem

    Hi All,

    I am querying city names from a table name country and displaying it as hyperlink. It is coming correctly.

    But on clicking on any city it should some information which I bring from other tables. It works fine if City Name is not having any space, like Delhi, Mumbai etc.
    But, when the City Name comes like - Montera Cty, ABC XYZ etc, then my program fails. I printed and found that these city names are going like Montera%20fCty, ABC%20fXYZ

    Then, in my program, I removed the special character sequence "%20f" with space " ". Now, I am getting error Array Out of Bound Exception.

    If anybody have any idea, please suggest how I can handle this problem or If I am doing anything wrong.

    I will be very thankful.

    Thanks in advance.


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: %20f problem

    Could you post your code? It's hard to figure out what's going on without it.

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: %20f problem

    I am getting error Array Out of Bound Exception.
    The index for the array is out of bounds.
    please suggest how I can handle this problem
    Suggestion: keep the index in bounds.

  4. #4
    Junior Member
    Join Date
    Jun 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: %20f problem

    Hi,

    That was the problem that I am not able to figure out how array out of bound exception is coming?

    I am sending the city name as a argument in my SELECT query -> Select * from table Country where city = :city.

    And, through my java program I am sending the value of city. It is working fine when city name is without any space but I am getting the error when there is space in city name like Montera Cty etc.

    I am not able to understand why it is happening. City name is not hardcoded,I am getting city name also from DB after querying.

    Kindly suggest if I am doing anything wrong.

    Thanks in advance.

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: %20f problem

    Can you post the full text of the error message. It can show where the error occurred and what the value of the index was.

    If you are indexing through an array where the error occurs, add a println just before the statement with the error to print out the value of the index.