wood burning stoves 2.0*
The moose likes Struts and the fly likes prob with bean:write 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 » Frameworks » Struts
Bookmark "prob with bean:write" Watch "prob with bean:write" New topic
Author

prob with bean:write

Amit KumarS
Ranch Hand

Joined: Oct 10, 2003
Posts: 100
hi all,
i have a prob with bean:write. the prob is
i am inserting value into database after taking value from one textarea. and then displaying that entered value into some other page using bean:write.
but the prob is when we enter the value and suppose we press enter key few time i.e. break down the text into different paragraphs. i am able to insert into database as it is.
but when i am trying to display those paragraphs using bean:write then it is omitting the line breaks. all the text is being displayed continuously instead of being displayed paragraph wise.
can some one help. Thanks a lot in advance.
Amit


****************************<br />In 24 hrs Earth rotates once on its Axis.
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
This is likely because
a) HTML treats more than one whitespace character (tab, space, CRLF, etc) as a single whitespace.
b) CRLF is not honored in HTML.
So you have a couple options.
1) When you get the data back from your database, you can replace all CRLF (aka \n or \r) characters with <br>
2) Put <pre> </pre> tags around the bean:write
3) Display all the text in a text box as it was entered (note that you can make this non-editable).


"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
Amit KumarS
Ranch Hand

Joined: Oct 10, 2003
Posts: 100
Hi david,
thanx a lot man... it really helped me a lot.. i couldn't used the changing of CLRF to <br> and also display the data in text box and make it non-editable due to some project constrants.
but the <pre></pre> tag helped me a lot.
but now the prob is that the tag is not wrapping the text which i need to do. if the text is too long then i need it to be displayed after wrapping. but right now it is getting away from the browser's view and we have to scroll the text. this text is in a table so the row is also getting widened.
is there any solution to this???

thanx a lot man.
Amit
[ March 25, 2004: Message edited by: Amit KumarS ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: prob with bean:write
 
Similar Threads
servlet display problem
Display problem
double quotes handling
escaping strings using Struts html:text tag
Spring - loading text field