• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

suggestion for html

 
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Arch enemy? I mean, I don't like you, but I don't think you qualify as "arch enemy". Here, try this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic