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. In article <3f1ed75f$>, "Chris" <>
    wrote:

    >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?


    Neither, it's an HTML thing. Multiple spaces = 1 space
    in HTML text. If you need these spaces, use

    <option value="foo bar">foo bar</option>

    in your JSP.
     
    Chris Riesbeck, Jul 31, 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:
    401
    Manish Jethani
    Jul 23, 2003
  2. John B. Matthews
    Replies:
    4
    Views:
    694
    John B. Matthews
    Sep 12, 2008
  3. Roedy Green
    Replies:
    3
    Views:
    658
  4. Tomasz Chmielewski

    [CSS] how can I show spaces as spaces?

    Tomasz Chmielewski, Sep 5, 2009, in forum: HTML
    Replies:
    21
    Views:
    1,679
    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:
    908
    Jan C. Faerber
    Sep 10, 2009
Loading...

Share This Page