• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

MS-Access problem

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,
I am working with servlets, using JSDK2.0 & MS-Access as database.
I have a table with column name Address & having a value "251, Anna Salai, Chennai-33" in that column. I want to display this in a textfield of HTML page. I used following code:
out.println("<tr><td>Address:</td><td><input type=text name=City value="+rs.getString(5)+"></td></tr>");
The problem is it is displaying only 251 in the textfield. But, I want to display complete string. How to do it? Please help.
Rani
[This message has been edited by Thomas Paul (edited February 21, 2001).]
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this:
out.println("<tr><td>Address:</td><td><input type=text name=City value='"+rs.getString(5)+"'></td></tr>");


The only change is the addition of single quotes around the string returned by the getString(5). The problem is that you are creating HTML that looks like this:


<input type=text name=City value=251, Anna Salai, Chennai-33>


Without single quotes around the value, the browser is reading the comma as the end of the value field.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic