Frequently Asked Questions

Poem

  1. What is a troid?
  2. What is a cooked object?

Melati

  1. How do I use Velocity?
  2. How are input widgets rendered?
  3. Where are templets located?
  4. How do I supply a context utility class to my template?
  5. Why do I need the servlet jar in my classpath, even outside a servlet environemt?

Database problems

  1. Why do I get Table Not Found errors when using an Access Database?

Poem

What is a troid?

A Table Row Object ID.

A Table Row Object Id is typically the primary key column of a table.

[top]


What is a cooked object?

A cooked object is one which has attached metadata.

[top]

Melati

How do I use Velocity?

In your org.melati.MelatiServlet.properties set

org.melati.MelatiServlet.templateEngine=org.melati.template.velocity.VelocityTemplateEngine.

This will set Melati to use Velocity as it's Template Engine. The resource loader used is an extended ClasspathResourceLoader which will do on-the-fly translations of simple webmacro templates as well as handling Velocity templates. This enables you to use the Melati Admin system in conjunction with your velocity templates.

Note that you will have to change the code in VelocityTemplateEngine if you wish to use a FileResourceLoader, but the code is available and tested.

[top]


How are input widgets rendered?

Input widgets, such as select boxes and popup selections, are rendered using a templet named after their class with an optional classifier called renderInfo in their field attributes.

[top]


Where are templets located?

Templets are found on the classpath in a sub directory of your configured template engine.

The subdirectory is determined by your MarkupLanguage and an optional purpose.

Default Object WebMacro templet for HTML org/melati/template/webmacro/templets/html/java.lang.Object.wm
Default Object Velocity templet for HTML org/melati/template/velocity/templets/html/java.lang.Object.wm
Error Exception Velocity templet for HTML org/melati/template/velocity/templets/html/error/java.lang.Exception.wm
Error Exception Velocity templet for WML org/melati/template/velocity/templets/wml/error/java.lang.Exception.wm

If a templet is not found then the templet loader looks for a templet with the same name as the class on the classpath.

If a templet is still not found then the process is repeated for each of the superclasses of your class until the default templet is reached.

[top]


How do I supply a context utility class to my template?

Ensure your utility class has a constructor which takes a single argument of a Melati and then add something like this to your template:

#set $admin = $melati.ContextUtil("org.melati.admin.AdminUtils")
       

[top]


Why do I need the servlet jar in my classpath, even outside a servlet environemt?

Both WebMacro and Velocity use an overly inclusive caching mechanism, where they introspect all methods on an object when checking for the existance of one method. As a Melati object has methods which return objects from the javax.servlet.http package the servlets jar is required, even when not used.

[top]

Database problems

Why do I get Table Not Found errors when using an Access Database?

[Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot find the input table or query 'tableinfo'. Make sure it exists and that its name is spelled correctly.

By default MS Access Databases are created with UserCommitSync set to no, use the ODBC Datasource Administrator or Registry Editor to set this to yes.

If that does not work, then run the test or application again, it should work on the second occasion.

This problem was particularly acute for PreparedStatements, which now wait and try again up to 10 times until the Jet Cache resyncs.

[top]