displaying data

i have to retrieve data from a mysql database to then display it in input text boxes on a web page. but i cant retrieve all the data in a particular field. for example if the field value is 'united kingdom' only 'united' is being displayed. i can only retrieve the first word thats in the field.

any idea how to fix this?

thank u in advance

regards

public ArrayList<String> editprofile(int id)throws RemoteException

{

ArrayList<String> retStr =new ArrayList<String>();

ResultSet rs;

try

{

StringBuffer query =new StringBuffer("Select * from profile where pid="+id);

rs = st.executeQuery(query.toString());

if (rs.next()){

String title = (rs.getString(3));

String name = (rs.getString(4));

String surname = (rs.getString(5));

String position = (rs.getString(7));

String cname = (rs.getString(6));

String address = (rs.getString(8));

String contactno = (rs.getString(9));

String email = (rs.getString(10));

String desc = (rs.getString(11));

retStr.add(new String("<tr><td class=\"style4\">Full Name</td><td class=\"style2\"> "+title+"\t"+surname+"\t"+name+"</td></tr>"));

retStr.add(new String("<tr><td class=\"style4\">Company Name </td><td class=\"style2\"> <input type=\"text\" name=\"cname\" value="+cname+" /></td></tr>"));

retStr.add(new String("<tr><td class=\"style4\">Position held </td><td class=\"style2\"> <input type=\"text\" name=\"position\" value="+position+" /></td></tr>"));

retStr.add(new String("<tr><td class=\"style4\">Address </td><td class=\"style2\"> <input type=\"text\" name=\"address\" value="+address+" /></td></tr>"));

retStr.add(new String("<tr><td class=\"style4\">Contact Number </td><td class=\"style2\"> <input type=\"text\" name=\"contactno\" value="+contactno+" /></td></tr>"));

retStr.add(new String("<tr><td class=\"style4\">Email </td><td class=\"style2\"> <input type=\"text\" name=\"email\" value="+email+"/></td></tr>"));

retStr.add(new String("<tr><td class=\"style4\">Description given</td><td class=\"style2\"> <input type=\"text\" name=\"description\" value="+desc+" /></td></tr>"));

retStr.add(new String("<tr><td class=\"style4\">Registration Date </td><td class=\"style2\"> "+rs.getString(12)+"</td></tr>"));

retStr.add(new String("<tr><td class=\"style4\">Your current status is</td><td class=\"style2\"> "+rs.getString(13)+"</td></tr>"));

}

}

catch(Exception e1)

{

e1.printStackTrace();

}

return retStr;

}

[4310 byte] By [victoriousa] at [2007-11-27 6:37:58]
# 1
This is an HTML problem, not a JDBC problem.In particular if you produce sloppy HTML and don't quote your attribute values, then spaces in those values do make a difference. Have a look at the HTML you are generating.
DrClapa at 2007-7-12 18:06:27 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...