I am using JSF as a front-end technology for one of my project. My application works on Tomcat web server. In my application, on one of page, I have to extract a data from database and have to display on the page.
I am extracting a data from database and populates it in the java bean. I am using h: outputText While displaying data on the jsf page. My code is as follows
Problem is when data is too long in the database then all data gets displayed in one line. Horizontal scrollbar gets added to the page, as some of the data is of 1500 character length.
I will like to know the way of wrapping a text in the JSF. So that while displaying data on the page, I will wrap the text and page will display within the limit of browser.
Just like you, struggeling to get the right solutions!<br /> <br />Sun Certified Java Programmer 1.5<br /> <br />Target - SCWCD
Henrique Sousa
Ranch Hand
Joined: Apr 29, 2004
Posts: 92
posted
0
Which element is the outputText in? And what are the style rules for "lightGray" CSS class? In most HTML elements, text is wrapped correctly. Exceptions for absolutely positioned elements and those with "white-space: nowrap" CSS attribute. As a workaround, try to define a width for the element to see if the text gets wrapped. If M$IE accepted "max-width" CSS attribute, I would recommend it. Regards
Henrique Sousa<br />SCJP 1.4<br /> <br />All men die, not all men really live - Braveheart, 1995
Can you please guide me in wrapping the text above. I want to avaoid the horizontal scroll bar that comes when the data length is too long.
Thanks Dhananjay
Henrique Sousa
Ranch Hand
Joined: Apr 29, 2004
Posts: 92
posted
0
Well, the generated HTML should be something like this
This is expected to work as you intend, unless some of the style rules says white-space: nowrap. If you are using Firefox it would be easy to change the td element to include white-space: normal using DOM Inspector and see what happens. Otherwise, you should do it manually. The intended result is something like this:
If the text does not contains white spaces you have a big problem because then it will not be wrapped anyway.