Lost spaces in http request

Discussion in 'Java' started by Chris, Jul 23, 2003.

  1. Chris

    Chris Guest

    I've got a <select> drop down in a JSP page. Sometimes one of the options in
    the select has multiple spaces between words, i.e.

    <select name="mydropdown">
    <option>foo bar</option>
    </select>

    If the user selects this option, the http request object that comes in has a
    value for "mydropdown" that contains only one space between foo and bar.
    This is a problem because the options are dynamically generated from a
    database, and when the user makes a selection I need to do a lookup back
    into the database. The spaces cause a mismatch.

    Is this a browser thing or a JSP thing? Is there a setting that will solve
    it?
     
    Chris, Jul 23, 2003
    #1
    1. Advertising

  2. Tor Iver Wilhelmsen wrote:

    > "Chris" <> writes:
    >
    >
    >>Is this a browser thing or a JSP thing? Is there a setting that will solve
    >>it?

    >
    >
    > It's a HTML thing: Whitespace reduction is the rule.
    >
    > You need to use some other character and convert back and forth.


    HTML is not so lame. Use the /value/ attribute:

    <select name="mydropdown">
    <option value="foo bar">foo bar</option>
    </select>

    HTH.

    --
    Manish Jethani (manish.j at gmx.net)
    phone (work) +91-80-51073488
     
    Manish Jethani, Jul 23, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris

    Lost spaces in http request

    Chris, Jul 23, 2003, in forum: Java
    Replies:
    1
    Views:
    637
    Chris Riesbeck
    Jul 31, 2003
  2. John B. Matthews
    Replies:
    4
    Views:
    671
    John B. Matthews
    Sep 12, 2008
  3. Roedy Green
    Replies:
    3
    Views:
    627
  4. Tomasz Chmielewski

    [CSS] how can I show spaces as spaces?

    Tomasz Chmielewski, Sep 5, 2009, in forum: HTML
    Replies:
    21
    Views:
    1,610
    Jan C. Faerber
    Sep 10, 2009
  5. Tomasz Chmielewski

    how can I show spaces as spaces, part 2

    Tomasz Chmielewski, Sep 9, 2009, in forum: HTML
    Replies:
    14
    Views:
    879
    Jan C. Faerber
    Sep 10, 2009
Loading...

Share This Page