title: getString from ResultSet with spaces
body: <p>I'm managing a JDBC database with Servlets/JSPs and one of the attributes I have in a table is a string which may or may not have spaces in between words. I have one JSP to display all the information and another one to edit it, on both I perform <code>getString</code> to a <code>ResultSet</code> and when I'm just displaying it it works fine, but on the edit JSP it only "grabs" the first word before the space and the rest of the string disappears. Here's part of the code:</p>
  
  <p><strong>PerfilUsuarioConectado.jsp</strong> (the one I use to display the data)</p>
  
  <pre><code>&lt;%
      Connection conexion = DriverManager.getConnection("jdbc:odbc:gasteizcar", "", "");
      Statement set = conexion.createStatement();
      ResultSet rs = set.executeQuery("SELECT * FROM Usuario WHERE correoElectronico ='" + session.getAttribute("username") + "'");
      rs.next();
  %&gt;
  &lt;div id="principal"&gt;
      &lt;table border="1" align="center"&gt;
          &lt;tr&gt;
              &lt;td&gt; Nombre: &lt;/td&gt;
              &lt;td&gt; &lt;%= rs.getString("nombre")%&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt; Apellidos: &lt;/td&gt;
              &lt;td&gt; &lt;%= rs.getString("apellidos")%&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt; E-mail: &lt;/td&gt;
              &lt;td&gt; &lt;%= rs.getString("correoElectronico")%&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt; Alias: &lt;/td&gt;
              &lt;td&gt; &lt;%= rs.getString("alias")%&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt; Nº móvil: &lt;/td&gt;
              &lt;td&gt; &lt;%= rs.getString("movil")%&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt; Coche: &lt;/td&gt;
              &lt;td&gt; &lt;%= rs.getString("marca") + " " + rs.getString("modelo") + " " + rs.getString("color")%&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>ModificarDatos.jsp</strong> (the one to edit the data)</p>
  
  <pre><code>&lt;%
      Connection conexion = DriverManager.getConnection("jdbc:odbc:gasteizcar", "", "");
      Statement set = conexion.createStatement();
      ResultSet rs = set.executeQuery("SELECT * FROM Usuario WHERE correoElectronico ='"
              + session.getAttribute("username") + "'");
      int i = 0;
      rs.next();
      String marca = rs.getString("marca");
      String modelo = rs.getString("modelo");
      String color = rs.getString("color");
      String movil = rs.getString("movil");
  %&gt;
  &lt;div id="principal"&gt;
      &lt;form id="datos" action="ModificarDatos" method="post"&gt;
          &lt;table border="1" align="center"&gt;
              &lt;tr&gt;
                  &lt;td&gt; * Verificar con contraseña: &lt;/td&gt;
                  &lt;td&gt; &lt;input pattern="[a-zA-Z0-9 ]{3,12}" type="password" id="password" name="password" required&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt; ** Nueva contraseña: &lt;/td&gt;
                  &lt;td&gt; &lt;input pattern="[a-zA-Z0-9 ]{3,12}" type="password" id="nuevaContrasenia" name="nuevaContrasenia"&gt; &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt; ** Repita la contraseña: &lt;/td&gt;
                  &lt;td&gt; &lt;input pattern="[a-zA-Z0-9 ]{3,12}" type="password" id="repContrasenia" name="repContrasenia"&gt; &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt; * Nº de móvil: &lt;/td&gt;
                  &lt;td&gt; &lt;input pattern="[0-9]{9}" type="text" name="movil" id="movil" required value=&lt;%= movil%&gt;&gt; &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt; *** Marca del coche: &lt;/td&gt;
                  &lt;td&gt; &lt;input type="text" name="marca" id="marca" value=&lt;%= marca%&gt;&gt; &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt; *** Modelo del coche: &lt;/td&gt;
                  &lt;td&gt; &lt;input type="text" name="modelo" id="modelo" value=&lt;%= modelo%&gt;&gt; &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt; *** Color: &lt;/td&gt;
                  &lt;td&gt; &lt;input type="text" name="color" id="color" value=&lt;%= color%&gt;&gt; &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
  &lt;/div&gt;
  &lt;input type="button" id="bActualizar" value="Actualizar datos"&gt;
  </code></pre>
  
  <p>So, if anyone can tell me why does the <code>getString</code> method perform differently in both situations I'd be really grateful.</p>