Thanks Pierre and Siriam, it works perfectly. This is a very good discussion
group with generous people willing to help.

Have a good day!
Barb J.

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Pierre-Yves Saumont
Sent: Friday, May 18, 2001 12:55 PM
To: [EMAIL PROTECTED]
Subject: Re: jsp text in sql call


The correct form is value = 'Betty Ann'. Unless you put quotes, only the
first word will show. You will have other problems. If you use single
quotes, you will sometimes end with something like value='O'Reilly' and it
will show as O. You have to take care of this and escape all special
caracters (using entities) before ouputing to HTML. You can use double
quotes if you are sure your data will never include double quotes, but you
should not rely on this.

BTW, I suggested to look at the HTML code because doing so, you can see that
the quotes are missing ;-) (Browsers are very loosy regarding syntax, but
there should be quotes. Now, you now why !)

Pierre-Yves

-----Message d'origine-----
De : A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]De la part de
Barbara Johnson
Envoy� : vendredi 18 mai 2001 18:10
� : [EMAIL PROTECTED]
Objet : Re: jsp text in sql call


Thanks for suggesting that I check the generated HTML. Everything is there
where it is supposed to
be, i.e. Betty Ann for the firstname is in value = Betty Ann but on the form
only the Betty shows and not the Ann.
Any ideas?
Thanks

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Pierre-Yves Saumont
Sent: Friday, May 18, 2001 11:08 AM
To: [EMAIL PROTECTED]
Subject: Re: jsp text in sql call


Hi, Barbara,

Seems that quotes are missing around the values.

When this kind of problem arise, you should have a look at the generated
HTML. It generally helps finding what's going wrong.

Pierre-Yves

-----Message d'origine-----
De : A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]De la part de
Barbara Johnson
Envoy� : vendredi 18 mai 2001 16:23
� : [EMAIL PROTECTED]
Objet : Re: jsp text in sql call


Can anyone tell me how to solve this problem?
I am making a series of forms for an educational application.
I am able to insert data into a database ok. When I look into MySql the data
is all there but when I
repopulate the form from the database, the words are truncated as soon as it
encounters a space.


Here is a sample of my code:




// query statement
Statement stmt = con.createStatement();
String queryStr = "SELECT firstname,lastname FROM author";
ResultSet rs = stmt.executeQuery(queryStr);


while (rs.next()){
     String firstname = rs.getString(1);
           String lastname = rs.getString(2);

<!--Repopulate form from database -->
<FORM name=authorform action="saveauthor.jsp" >

<td>

        <input name="firstname" size="30" value=<%= firstname%>>


        <input name="lastname" size="30" value=<%= lastname%>>

Thank you,
Barb Johnson
Instructional Programmer
Northeast Ohio Universities College of Medicine

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to