#list, Newbie Question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

#list, Newbie Question

Zerbst, Carsten
Hello,

I want to use freemarker to create some java code.
All variables needed for an attribute are contained in a simple
object like

class AttributeWrapper {  
    public String getExpressName() {...
    public String getName() { ...
    public String getType() {...
}

I provide a list with these wrappers, access on the wrappers itself does
work.
But when I want to access the the bean attributes in my template like
       
  <#list attributes as attr >
    public final static String ${attr.name?upper_case}_VALUE =
"${attr.name}";    
    </#list>

I get
671 [main] ERROR freemarker.runtime  -
Expression attr.name is undefined on line 45, column 34 in
SimpleEntity.vm.


What do I need to access the attributes of list items ?

Thanks, Carsten


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Reply | Threaded
Open this post in threaded view
|

Re: #list, Newbie Question

Daniel Dekany
Tuesday, August 15, 2006, 11:34:30 AM, Zerbst, Carsten wrote:

> Hello,
>
> I want to use freemarker to create some java code.
> All variables needed for an attribute are contained in a simple
> object like
>
> class AttributeWrapper {  
>     public String getExpressName() {...
>     public String getName() { ...
>     public String getType() {...
> }
>
> I provide a list with these wrappers, access on the wrappers itself does
> work.
> But when I want to access the the bean attributes in my template like
>        
>   <#list attributes as attr >
>     public final static String ${attr.name?upper_case}_VALUE =
> "${attr.name}";    
>     </#list>
>
> I get
> 671 [main] ERROR freemarker.runtime  -
> Expression attr.name is undefined on line 45, column 34 in
> SimpleEntity.vm.

Maybe the "name" property of some beans is null in the data model?
What does this print?:

<#list attributes as attr >
  public final static String ${attr.name?upper_case!'missing'}_VALUE = "${attr.name!'missing'}";
</#list>

--
Best regards,
 Daniel Dekany


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Reply | Threaded
Open this post in threaded view
|

Re: #list, Newbie Question

Daniel Dekany
Tuesday, August 15, 2006, 1:09:15 PM, Daniel Dekany wrote:

> Tuesday, August 15, 2006, 11:34:30 AM, Zerbst, Carsten wrote:
>
>> Hello,
>>
>> I want to use freemarker to create some java code.
>> All variables needed for an attribute are contained in a simple
>> object like
>>
>> class AttributeWrapper {  
>>     public String getExpressName() {...
>>     public String getName() { ...
>>     public String getType() {...
>> }
[snip]

Also, that class should be public.

--
Best regards,
 Daniel Dekany


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user