• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Line Breaks when displaying HTML

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's an issue I've been working with lately. I have a bunch of text in a database, and when I display it with JSP, I want to interpret the hidden line break characters (\n, etc), as <br> tags. I have a handle on how to do it (StringTokenizer, String.indexOf()), etc., but I can't seem to search for the right sequence of characters. I thought it went like this .. line breaks on Unix were \n, line breaks on mac were \l, PC had \n\l. I guess this isn't working.
Can someone help me out?
Thanks a lot!
Steve
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I always use these methods...

 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wouldn't it be easier to use one of the input stream methods that have a readLine() method? What form does the database return the text in?
Bill
 
Steven Fischer
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help .. Bill, to answer your question, I am getting a string using the Recordset object rcdSet.getString("dbasefield") method.
 
Steven Fischer
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bhupinder,
Your code recommendations worked out excellent. Thanks a ton!
Steve
 
reply
    Bookmark Topic Watch Topic
  • New Topic