Meaningless Drivel is fun!
The moose likes Servlets 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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "MS-Access Problem" Watch "MS-Access Problem" New topic

MS-Access Problem

Rani Mukherjee

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.
anand chawla
Ranch Hand

Joined: Oct 19, 2000
Posts: 91
i think what i told may be wrong try this thing
instead of this one
out.println("<tr><td>Address:</td><td><input type=text name=City value="+rs.getString(5)+"></td></tr>");

out.println("<tr><td>Address:</td><td><input type=text name=City value='"+rs.getString(5)+"'></td></tr>");
just copy and paste this in ur code
it will work
[This message has been edited by anand chawla (edited February 22, 2001).]
anand chawla
Ranch Hand

Joined: Oct 19, 2000
Posts: 91
the problem lies in the spacing
instead of ur statment
out.println("<tr><td>Address:</td><td><input type=text name=City value="+rs.getString(5)+"></td></tr>");
try this one the mistake is the value in address field in database.Just reduce the spacing between 251 and Anna and following ones.because value doesnt take anything after space.
just remove space in database and try it shold work
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
As an aside, you should always quote values for all tag attributes. Both strict HTML and XML require that all attribute values are quoted, and getting into the habit will help prevent misunderstandings like this. I suggest generating HTML like the following:

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link:
subject: MS-Access Problem
It's not a secret anymore!