commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Lario" <la...@Inherit.com>
Subject [Jelly] Process Templates with taglib and Beans
Date Thu, 01 Jan 2004 22:50:11 GMT
I am trying to process a template that accesses a bean.  I have set name
using context.setVariable("name","robert"); If I leave in ${c1.lastName}
in the template I get a class def found error. If I remove the line
${c1.lastName} the template processes as expected.  What am I missing?
Is there any good documentation on how to define taglibs?  
 
Any help would be greatly appreciated - I have been stuck on this for
several days.
 
Thanks
 
 
Here is the template :
 
<?xml version="1.0"?>
<j:jelly xmlns:j="jelly:core" xmlns:define="jelly:define"
xmlns:my="myDummyTagLib">
  <define:taglib uri="myDummyTagLib">      
    <define:bean name="customer"
className="com.diem.templates.Customer">
            <define:attribute name="lastName" required="true"/>
    </define:bean>           
  </define:taglib>
 <my:customer var="c1" lastName="smith"/>
<!--
    the following line ${c1.lastName} is what causes the error:
    java.lang.NoClassDefFoundError:
org/apache/velocity/util/introspection/Uberspect 
    if I remove the line then this file is processed as expected.  Also
note, to test to see that
    the Customer class is accessible, I added an X to then end of
com.diem.templates.Customer in classname of
    define:bean above - got an error as expected - thus indicating that
Customer is found
-->
    ${c1.lastName}
    ${name}'s Page
    ${name}'s Homepage
 </j:jelly>
 
 
Here is the bean :
 
package com.diem.templates;
 
public class Customer {
    
    private String lastName;
  
    public Customer() {
    }
    public String getLastName() {
        return this.lastName;
    }
    
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }  
}
 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message