The Artima Developer Community
Sponsored Link

Java Buzz Forum
Separate generating content from printing it out

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
dion

Posts: 5028
Nickname: dion
Registered: Feb, 2003

Dion Almaer is the Editor-in-Chief for TheServerSide.com, and is an enterprise Java evangelist
Separate generating content from printing it out Posted: Sep 12, 2006 10:02 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by dion.
Original Post: Separate generating content from printing it out
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Latest Java Buzz Posts
Latest Java Buzz Posts by dion
Latest Posts From techno.blog(Dion)

Advertisement

I am currently working on a legacy application that has a lot of the following:


show_article()

show_article() goes out, grabs the article (based on some evil global variables ;) and prints it out as it goes.

This makes it bloody hard to test, and *really* hard to cache. To handle scalability I may want to get that article and save the HTML to disk for use later, or grab the article object and put it in a distributed cache, or ....

The fact that most of the methods in this application do not return strings, but rather just go ahead and print to STDOUT makes life a real nightmare.

This is one of the pros of Velocity vs. JSP. Why can't we create a JSP engine, setup bindings, execute, and get back a string? Then we could even use JSP outside of the web scope (e.g. to generate emails).

Read: Separate generating content from printing it out

Topic: Sun Acquires JRuby Project Previous Topic   Next Topic Topic: Meet Tom Ball, Technical Director at Sun Microsystems

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use