wood burning stoves 2.0
The moose likes Java in General and the fly likes suggestion for html Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "suggestion for html" Watch "suggestion for html" New topic

suggestion for html

Jackie Wang
Ranch Hand

Joined: Apr 18, 2002
Posts: 315
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

Joined: Apr 18, 2002
Posts: 315
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

Joined: May 31, 2001
Posts: 123
A good open source solution might be the Velocity template engine project. Here is an introductory article at JavaWorld:
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)

Jackie Wang
Ranch Hand

Joined: Apr 18, 2002
Posts: 315
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

Joined: Apr 18, 2002
Posts: 315
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

Joined: Sep 13, 2002
Posts: 21
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
subject: suggestion for html
jQuery in Action, 3rd edition