aspose file tools*
The moose likes Servlets and the fly likes embedding html in servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "embedding html in servlets" Watch "embedding html in servlets" New topic
Author

embedding html in servlets

Vinay Thippeswamy
Greenhorn

Joined: Apr 26, 2006
Posts: 15
hi ,

iam new to servlets. Is there any utility to convert all that html into code that is compatabile to fit into out.println(). i mean with all that double quotation inserted automatically. i tried google but didnt find anything.

thanks
vinay.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

A simple answer would be : don't do this in a servlet, that is not its role. Output html in html/jsp files, that will save you time and readability.


[My Blog]
All roads lead to JavaRanch
Vinay Thippeswamy
Greenhorn

Joined: Apr 26, 2006
Posts: 15
thanks,
i knew about that. i was wondering if there was such an utility.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

A search and replace with regular expressions with a simple text editor ?
1. Replace the start of a line with out.print("
2. Replace the end of a line with ");
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61762
    
  67

"vinay vinay",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vinay Thippeswamy
Greenhorn

Joined: Apr 26, 2006
Posts: 15
sorry.
i had read your naming policy. and i knew i would be warned about it.
but i have just one name and thats VINAY. since your form didnt allow me to proceed, i had no choice but to put my last name as vinay.

hey how about vinay schwarzenegger???

regards
vinay
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61762
    
  67

Please respond to the Private Message that I sent to you.
rajsunder reddy
Greenhorn

Joined: Jun 04, 2006
Posts: 18
Originally posted by Satou kurinosuke:
A search and replace with regular expressions with a simple text editor ?
1. Replace the start of a line with out.print("
2. Replace the end of a line with ");


did you try doing it with any html page???
HINT: there are some things called escape characters that need to be taken care of, if you dont then there would be 165 errors when you compile iit
Al Hollis
Ranch Hand

Joined: Dec 12, 2005
Posts: 60
You can just put html tags directly into a print statement exactly as mentioned above
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

rajsunder, thank you for warning about escape characters

did you try doing it with any html page???

Actually no, because I always put HTML where it ought to be : in an HTML/JSP file.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: embedding html in servlets