Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

suggestion for html

 
Jackie Wang
Ranch Hand
Posts: 315
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am thinking of writing some classes for printing out the text report.
Different reports will contain different column number, and different alignment and length.
So I think I should write a generic one as a "template" as interface? or parents class?
Can anyone have some suggestion? Thanks!
 
Jackie Wang
Ranch Hand
Posts: 315
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The report will be like:

Person Goods Percent
A 130 9.23%
B 2 20.00%
C 5 2.55%

So I think i will create a html file with table so that it will be align well, any beter suggestion?
 
Julia Reynolds
Ranch Hand
Posts: 123
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A good open source solution might be the Velocity template engine project. Here is an introductory article at JavaWorld:
http://www.javaworld.com/javaworld/jw-12-2001/jw-1228-velocity.html
Summary
The Velocity Template Engine lets you render data from within applications and servlets. Primarily used to develop dynamic, servlet-based Websites, Velocity's clean separation of template and Java code makes it ideal for Model 2-style Model-View-Controller (MVC) Web development. As a general template engine, Velocity suits many other purposes, such as code generation, XML generation and transformation, and textual stream processing. This article introduces the Velocity Template Language (VTL) and provides examples of how to use the Velocity engine, including how to generate Web content in a Java servlet environment. (3,000 words; December 28, 2001)

Julia
 
Jackie Wang
Ranch Hand
Posts: 315
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks julia for the quick response.
But I am wondering whether there's an easier approach becoz my report is really really simple.
Any suggestion? I really appreciated it.
 
Jackie Wang
Ranch Hand
Posts: 315
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C:\jdk1.3.1\bin\javaw.exe -classpath C:\jdk1.3.1\jre\lib\rt.jar;C:\Documents and Settings\bryanwong\My Documents\software\velocity;C:\Documents and Settings\bryanwong\My Documents\software\velocity\velocity\WEB-INF\lib\velocity-dep-1.2.jar;C:\Program Files\Apache Tomcat 4.0\lib\jasper-compiler.jar;C:\Program Files\Apache Tomcat 4.0\lib\jasper-runtime.jar;C:\Program Files\Apache Tomcat 4.0\lib\naming-factory.jar;C:\Program Files\Apache Tomcat 4.0\servlet.jar HelloWorld
org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'helloworld.vm'
at org.apache.velocity.runtime.resource.ResourceManager.getResource(ResourceManager.java:438)
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:736)
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:718)
at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:511)
at HelloWorld.main(HelloWorld.java:27)
Exception in thread "main" Process terminated with exit code 1

any one can help me? I have already included that vm file in the same directory.
 
Neal Swearer
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your Java code you need to specify where the Velocity engine should look for ".vm" files.

Hope it helps.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic