Re: freemarker.template.TemplateModelException: Attribute with name not found

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Saturday, March 28, 2009, 10:54:29 AM, Amin Mohammed-Coleman wrote:
> Yep.  The it works with jsp.  It's only happening with freemarker, 
> I'm at the point of tearing my hair out and I don;t have much!

Yeah, that's just an everyday thing for developers... BTW, I'm not the
author of any of these software, so I'm not in charge more than you
are. ;) But let's debug this stuff... I looked at the Tiles FreeMarker
support on their SVN
(http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/),
and I see they have re-implemented the tags directly as FreeMarker
directives, rather than wrapping the JSP tags using the FreeMarker JSP
support. So that for one can cause differences... So, first of all,
are you using those tags, or the JSP tags through FreeMarker JSP
support?

> Cheers
> Amin
>
> 2009/3/28 Daniel Dekany <[email protected]>
> Saturday, March 28, 2009, 9:08:21 AM, Amin Mohammed-Coleman wrote:
>
>> Hi
>>
>> I'm not sure if I follow. The personalContact is available outside the
>> tags. It doesn't exist inside the tile definition.
>
> (Yeah, as I said in the earlier message, it was me who overlooked
> something...)
>
> Did you try the same by using JSP-s instead of FTL-s? Does it work
> that way?
>
>
>> There must be a way to achieve this...
>>
>> Cheers
>>
>> Amin
>>
>>
>> On 27 Mar 2009, at 23:49, Daniel Dekany <[email protected]> wrote:
>>
>>> Friday, March 27, 2009, 11:02:50 PM, amin1977 wrote:
>>>
>>>> Hi
>>>>
>>>> Sorry to bring this up again, however I was wondering if someone
>>>> may be able
>>>> to help with the below problem.  I have tried everything that I can
>>>> think
>>>> of.
>>>
>>> Well, the error message says that the JSP directive that you call has
>>> no "personalContact" attribute. Are you sure it has it, exactly
>>> written like that?
>>>
>>>>
>>>> Cheers
>>>> Amin
>>>>
>>>>
>>>> amin1977 wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> I have a java object which I am passing into a tiles tag. For
>>>>> example:
>>>>>
>>>>> I can print out pcobj outside of the tags
>>>>>
>>>>>
>>>>> <@tiles.insertDefinition name="pagination.tile">
>>>>>      <@tiles.putAttribute name="personalContact" value=pcobj />
>>>>> </@tiles.insertDefinition>
>>>>>
>>>>>
>>>>> in my pagination tile I am doing:
>>>>>
>>>>>
>>>>> <@tiles.importAttribute name="personalContact" />
>>>>>
>>>>> EMAIL : ${personalContact.email} <br/>
>>>>> FIRST NAME: ${personalContact.firstName} <br/>
>>>>> LAST NAME: ${personalContact.lastName} <br/>
>>>>>
>>>>>
>>>>> However I am getting the following
>>>>>
>>>>> Attribute with name 'personalContact' not found
>>>>> The problematic instruction:
>>>>> ----------
>>>>> ==> user-directive tiles.importAttribute [on line 3, column 1 in
>>>>> WEB-INF/freemarker/pagination.ftl]
>>>>> ----------
>>>>>
>>>>> Java backtrace for programmers:
>>>>> ----------
>>>>> freemarker.template.TemplateModelException: Attribute with name
>>>>> 'personalContact' not found
>>>>>      at
>>>>> freemarker.ext.jsp.TagTransformModel
>>>>> $TagWriter.onStart(TagTransformModel.java:479)
>>>>>      at freemarker.core.Environment.visit(Environment.java:230)
>>>>>      at freemarker.core.UnifiedCall.accept(UnifiedCall.java:116)
>>>>>      at freemarker.core.Environment.visit(Environment.java:196)
>>>>>      at freemarker.core.MixedContent.accept(MixedContent.java:92)
>>>>>      at freemarker.core.Environment.visit(Environment.java:196)
>>>>>      at freemarker.core.Environment.process(Environment.java:176)
>>>>>      at freemarker.template.Template.process(Template.java:232)
>>>>>
>>>>>
>>>>> I would be grateful if anyone could advise me on what i'm doing
>>>>> wrong..
>>>>>
>>>>> Cheers
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>> --
>>> Best regards,
>>> Daniel Dekany
>>>
>>
>
>
> --
> Best regards,
>  Daniel Dekany
>
>
>

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.