File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Displaying only part of data in JSP Page Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply 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: 254
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
[Thumb - project_list.jpg]
 Filename project_list.jpg [Disk] Download
 Description Image File
 Filesize 251 Kbytes
 Downloaded:  4 time(s)

Seetharaman Venkatasamy
Bartender

Joined: Jan 28, 2008
Posts: 4503

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!


Not everything that counts can be counted, and not everything that can be counted counts-Albert Einstein
Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 254
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
Bartender

Joined: Jan 28, 2008
Posts: 4503

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: 254
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
[Thumb - project_list.jpg]
 Filename project_list.jpg [Disk] Download
 Description Image File
 Filesize 60 Kbytes
 Downloaded:  4 time(s)

Seetharaman Venkatasamy
Bartender

Joined: Jan 28, 2008
Posts: 4503

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: 774

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?
 
 
subject: Displaying only part of data in JSP Page
 
Threads others viewed
How to store answer available in option form in database table?
How to retrive data two times from database in sinble jsp page.
Error comes whilke compiling the jsp page
Passing more than one object between jsp and servlet
trouble with remove item fro shopping cart
developer file tools