• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Read & Write a file in a jsp page without modifying the alignment

 
Greenhorn
Posts: 28
Mac Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone guide me how to print a file in jsp page without changing the alignment of the text..?

Eg: while uploading,

Java Ranch
Friendly Place
for
greenhorns


But,while in reading and writing into a jsp page.,it prints as,

Java Ranch Friendly Place for greenhorns

how to Preserve the alignment ..?
 
Sheriff
Posts: 21917
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTML, which is what JSPs generate, handle whitespace differently. Any occurrence of one or more whitespace characters (including line breaks) are treated as one single space, unless they are in a <pre> block. To include a line break in non-<pre> blocks you should use <br>.
 
Sam Jimzz
Greenhorn
Posts: 28
Mac Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rob Spoor wrote:HTML, which is what JSPs generate, handle whitespace differently. Any occurrence of one or more whitespace characters (including line breaks) are treated as one single space, unless they are in a <pre> block. To include a line break in non-<pre> blocks you should use <br>.



Is that like this in the http://htmlhelp.com/reference/html40/block/pre.html

or

Could you please elaborate it using an example..
 
Rob Spoor
Sheriff
Posts: 21917
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's exactly what I meant with the <pre> block.

An example with <br> is easy. Just put the following into a simple HTML file and view it in your browser:
 
Sam Jimzz
Greenhorn
Posts: 28
Mac Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob..

I tried with your assistance & its working.

But the issue is.,whenever the file has a long lines,a part of the long line is omitted while printing that page.

when i tried to check for 80-100 characters in each line., the alignment in the page making a big difference.Specially in the case of paragraphs..
 
I'm doing laundry! Look how clean this tiny ad is:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic