GeeCON Prague 2014*
The moose likes JSP and the fly likes Displaying only part of data in JSP Page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Displaying only part of data in JSP Page" Watch "Displaying only part of data in JSP Page" New topic
Author

Displaying only part of data in JSP Page

Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 263
Dear Ranchers

I have to provide a tabluar view of the data retreiving from the database table. One column has a long description of the data where by i have provided 50% width for it. Once it is exceeding the 50% width, the information is going to the next line (like WRAP Text) which is making my display un-tidy.

I would like display only the information with 40 characters, so that all the table rows will look perfectly.



Attached here with the sample output of the table. Please look at line number 37

Please let me have a solution for this.

Thanks/Regards

Aravind Prasad



[Thumbnail for project_list.jpg]

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

what happened when you apply nowrap attribute to the column[<td/>] ?

note: If it is a development project which you are coding a jsp, please avoid scriptlet, because you will end up with writing business logic in jsp which is difficult to maintain and debug!
Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 263
Dear seetharaman

Thanks for the feedback.

I tried no-wrap before and if i put, the information is streatching the table and it is becoming un-tidy. The only option is to display few characters.

The solution in my mind is

1. get the value in the string.
2. make substring
3. display the sub-string.

I am not sure whether the above login is correct or is there any easier way to sort this out.

Thanks/Regards

Aravind
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

my opinion: get the shorted string and display with more link, when the user click on the more then display the whole story on a popup window
Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 263
Dear Seetharaman

Thanks again. Your proposal is really good, but customer wants it the way i explained.

Presently I am using the substring option and displaying is fine and the customer is happy. Code is provided FYI and please refer the screen shot's line number 37




If there is any easier way, please advise, so that i can update myself accordingly.

thanks/Regards



[Thumbnail for project_list.jpg]

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

I wonder the project name is meaningful? and how about using a tooltips?
Chandraprakash Sarathe
Greenhorn

Joined: Jan 21, 2012
Posts: 16
Hope this will help.Better create a css file and define style for each class , you may have separate style for <tr> , <td>



Chandraprakash Sarathe
http://javaved.blogspot.com
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

Aravind Prasad wrote:Dear Seetharaman

Thanks again. Your proposal is really good, but customer wants it the way i explained.

Presently I am using the substring option and displaying is fine and the customer is happy. Code is provided FYI and please refer the screen shot's line number 37




If there is any easier way, please advise, so that i can update myself accordingly.

thanks/Regards


sorry if I misunderstood, but you want an easier solution than using substring?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Displaying only part of data in JSP Page