Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MS-Access problem

 
Rani Mukherjee
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • 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).]
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • 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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic