aspose file tools*
The moose likes JDBC and the fly likes MS-Access problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MS-Access problem" Watch "MS-Access problem" New topic
Author

MS-Access problem

Rani Mukherjee
Greenhorn

Joined: Jan 14, 2001
Posts: 24
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

Joined: May 05, 2000
Posts: 13974
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.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MS-Access problem