This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Creating an HTML table in a Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Creating an HTML table in a Bean" Watch "Creating an HTML table in a Bean" New topic
Author

Creating an HTML table in a Bean

Steven Lyner
Greenhorn

Joined: Jul 02, 2001
Posts: 10
I've been stuck on a problem for quite a while. I have a JSP that uses a bean to fetch data from a database table. The bean returns data in an HTML table. I would like to be able to edit some of the data and update my database using <INPUT> fields. Here's my problem: Some of the strings in my table have more than one word. When I use xxx.getString("COL_NAME") as the value, only the characters before the first space are returned. If I put my getString in quotes, I get the entire string including all of the spaces at the end. When I run the JSP, I have to delete some spaces in order to alter my value. Is there any way I get insert only the characters that I need. Since I'm new to Java, any comments about how I'm approaching this would be appreciated.
Thanks,
Steve
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040


I get the entire string including all of the spaces at the end. When I run the JSP, I have to delete some spaces in order to alter my value....

You probably may try to use the trim() method of the
String class. This eliminates the leading and trailing spaces
of a String object.
Not sure if this is what you are looking for...
regds.
- satya

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Steven Lyner
Greenhorn

Joined: Jul 02, 2001
Posts: 10
Satya,
That worked great.
Thanks,
Steve
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Creating an HTML table in a Bean
 
Similar Threads
seemingly simple td width issue
Submitting a table in a form
Notifiying EJB when database table changes
Getting HTML code from a java bean
dealing with non ascii characters