Problem with <#include> directive

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

Problem with <#include> directive

eysman
hi everyone,

I'm having an issue with the include directive in ofbiz. I'm doing a simple <#include "file.ftl"> command, but getting back a FileNotFoundException. The file is definetly where it should be, and I'm using the same code base as a few co-workers of mine, but I'm the only one experiencing this issue.

Has anyone come across this problem and can help me out?

Much appreciated,

John
Reply | Threaded
Open this post in threaded view
|

Re: Problem with <#include> directive

Adrian Crum
Freemarker will assume the included file is in the same folder as the
file that contains the include directive. If the file is located
somewhere else, then you will have to supply a complete pathname or URL.

-Adrian

eysman wrote:

> hi everyone,
>
> I'm having an issue with the include directive in ofbiz. I'm doing a simple
> <#include "file.ftl"> command, but getting back a FileNotFoundException. The
> file is definetly where it should be, and I'm using the same code base as a
> few co-workers of mine, but I'm the only one experiencing this issue.
>
> Has anyone come across this problem and can help me out?
>
> Much appreciated,
>
> John
Reply | Threaded
Open this post in threaded view
|

Re: Problem with <#include> directive

eysman
The file is located in the same directory, but Freemarker can't find it. I've also tried relative and absolute paths just for the sake of it and neither way works.

Adrian Crum wrote
Freemarker will assume the included file is in the same folder as the
file that contains the include directive. If the file is located
somewhere else, then you will have to supply a complete pathname or URL.

-Adrian

eysman wrote:
> hi everyone,
>
> I'm having an issue with the include directive in ofbiz. I'm doing a simple
> <#include "file.ftl"> command, but getting back a FileNotFoundException. The
> file is definetly where it should be, and I'm using the same code base as a
> few co-workers of mine, but I'm the only one experiencing this issue.
>
> Has anyone come across this problem and can help me out?
>
> Much appreciated,
>
> John
Reply | Threaded
Open this post in threaded view
|

Re: Problem with <#include> directive

Adrian Crum
Make sure the include directive has the file name in the correct case.
Sometimes problems like that are caused by the underlying OS and how it
handles filenames.

Windows: file.ftl == File.Ftl
Unix: file.ftl != File.Ftl


-Adrian

eysman wrote:

> The file is located in the same directory, but Freemarker can't find it. I've
> also tried relative and absolute paths just for the sake of it and neither
> way works.
>
>
> Adrian Crum wrote:
>> Freemarker will assume the included file is in the same folder as the
>> file that contains the include directive. If the file is located
>> somewhere else, then you will have to supply a complete pathname or URL.
>>
>> -Adrian
>>
>> eysman wrote:
>>> hi everyone,
>>>
>>> I'm having an issue with the include directive in ofbiz. I'm doing a
>>> simple
>>> <#include "file.ftl"> command, but getting back a FileNotFoundException.
>>> The
>>> file is definetly where it should be, and I'm using the same code base as
>>> a
>>> few co-workers of mine, but I'm the only one experiencing this issue.
>>>
>>> Has anyone come across this problem and can help me out?
>>>
>>> Much appreciated,
>>>
>>> John
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Problem with <#include> directive

Abdullah Shaikh-3
I guess you have included the freemarker handler

<handler name="ftl" type="view"
class="org.ofbiz.webapp.ftl.FreeMarkerViewHandler"/>

If not then you need to include the common-controller.xml, in your
controller, as below

<include
location="component://common/webcommon/WEB-INF/common-controller.xml"/>

common controller includeds all the event / view handlers.

Abdullah

On Tue, Nov 17, 2009 at 3:11 AM, Adrian Crum <[hidden email]> wrote:

> Make sure the include directive has the file name in the correct case.
> Sometimes problems like that are caused by the underlying OS and how it
> handles filenames.
>
> Windows: file.ftl == File.Ftl
> Unix: file.ftl != File.Ftl
>
>
> -Adrian
>
>
> eysman wrote:
>
>> The file is located in the same directory, but Freemarker can't find it.
>> I've
>> also tried relative and absolute paths just for the sake of it and neither
>> way works.
>>
>>
>> Adrian Crum wrote:
>>
>>> Freemarker will assume the included file is in the same folder as the
>>> file that contains the include directive. If the file is located somewhere
>>> else, then you will have to supply a complete pathname or URL.
>>>
>>> -Adrian
>>>
>>> eysman wrote:
>>>
>>>> hi everyone,
>>>>
>>>> I'm having an issue with the include directive in ofbiz. I'm doing a
>>>> simple
>>>> <#include "file.ftl"> command, but getting back a FileNotFoundException.
>>>> The
>>>> file is definetly where it should be, and I'm using the same code base
>>>> as
>>>> a
>>>> few co-workers of mine, but I'm the only one experiencing this issue.
>>>>
>>>> Has anyone come across this problem and can help me out?
>>>>
>>>> Much appreciated,
>>>>
>>>> John
>>>>
>>>
>>>
>>
Reply | Threaded
Open this post in threaded view
|

Re: Problem with <#include> directive

eysman
In reply to this post by Adrian Crum
Thanks Adrian,

The files are named correctly and are in the correct directory. I'm quite certain it has something to do with the configuration of OFBiz and not the implementation.

Adrian Crum wrote
Make sure the include directive has the file name in the correct case.
Sometimes problems like that are caused by the underlying OS and how it
handles filenames.

Windows: file.ftl == File.Ftl
Unix: file.ftl != File.Ftl


-Adrian

eysman wrote:
> The file is located in the same directory, but Freemarker can't find it. I've
> also tried relative and absolute paths just for the sake of it and neither
> way works.
>
>
> Adrian Crum wrote:
>> Freemarker will assume the included file is in the same folder as the
>> file that contains the include directive. If the file is located
>> somewhere else, then you will have to supply a complete pathname or URL.
>>
>> -Adrian
>>
>> eysman wrote:
>>> hi everyone,
>>>
>>> I'm having an issue with the include directive in ofbiz. I'm doing a
>>> simple
>>> <#include "file.ftl"> command, but getting back a FileNotFoundException.
>>> The
>>> file is definetly where it should be, and I'm using the same code base as
>>> a
>>> few co-workers of mine, but I'm the only one experiencing this issue.
>>>
>>> Has anyone come across this problem and can help me out?
>>>
>>> Much appreciated,
>>>
>>> John
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Problem with <#include> directive

eysman
In reply to this post by Abdullah Shaikh-3
I have included that handler in common-controller.xml, but I'm still having the same problem as before.


abdullah shaikh wrote
I guess you have included the freemarker handler

<handler name="ftl" type="view"
class="org.ofbiz.webapp.ftl.FreeMarkerViewHandler"/>

If not then you need to include the common-controller.xml, in your
controller, as below

<include
location="component://common/webcommon/WEB-INF/common-controller.xml"/>

common controller includeds all the event / view handlers.

Abdullah

On Tue, Nov 17, 2009 at 3:11 AM, Adrian Crum <adrianc@hlmksw.com> wrote:

> Make sure the include directive has the file name in the correct case.
> Sometimes problems like that are caused by the underlying OS and how it
> handles filenames.
>
> Windows: file.ftl == File.Ftl
> Unix: file.ftl != File.Ftl
>
>
> -Adrian
>
>
> eysman wrote:
>
>> The file is located in the same directory, but Freemarker can't find it.
>> I've
>> also tried relative and absolute paths just for the sake of it and neither
>> way works.
>>
>>
>> Adrian Crum wrote:
>>
>>> Freemarker will assume the included file is in the same folder as the
>>> file that contains the include directive. If the file is located somewhere
>>> else, then you will have to supply a complete pathname or URL.
>>>
>>> -Adrian
>>>
>>> eysman wrote:
>>>
>>>> hi everyone,
>>>>
>>>> I'm having an issue with the include directive in ofbiz. I'm doing a
>>>> simple
>>>> <#include "file.ftl"> command, but getting back a FileNotFoundException.
>>>> The
>>>> file is definetly where it should be, and I'm using the same code base
>>>> as
>>>> a
>>>> few co-workers of mine, but I'm the only one experiencing this issue.
>>>>
>>>> Has anyone come across this problem and can help me out?
>>>>
>>>> Much appreciated,
>>>>
>>>> John
>>>>
>>>
>>>
>>
Reply | Threaded
Open this post in threaded view
|

Re: Problem with <#include> directive

Adrian Crum
In reply to this post by eysman
I created a file called test.ftl and included it using

<#include "test.ftl"/>

and it works fine. I am unable to reproduce the problem you are having.

-Adrian

eysman wrote:

> Thanks Adrian,
>
> The files are named correctly and are in the correct directory. I'm quite
> certain it has something to do with the configuration of OFBiz and not the
> implementation.
>
>
> Adrian Crum wrote:
>> Make sure the include directive has the file name in the correct case.
>> Sometimes problems like that are caused by the underlying OS and how it
>> handles filenames.
>>
>> Windows: file.ftl == File.Ftl
>> Unix: file.ftl != File.Ftl
>>
>>
>> -Adrian
>>
>> eysman wrote:
>>> The file is located in the same directory, but Freemarker can't find it.
>>> I've
>>> also tried relative and absolute paths just for the sake of it and
>>> neither
>>> way works.
>>>
>>>
>>> Adrian Crum wrote:
>>>> Freemarker will assume the included file is in the same folder as the
>>>> file that contains the include directive. If the file is located
>>>> somewhere else, then you will have to supply a complete pathname or URL.
>>>>
>>>> -Adrian
>>>>
>>>> eysman wrote:
>>>>> hi everyone,
>>>>>
>>>>> I'm having an issue with the include directive in ofbiz. I'm doing a
>>>>> simple
>>>>> <#include "file.ftl"> command, but getting back a
>>>>> FileNotFoundException.
>>>>> The
>>>>> file is definetly where it should be, and I'm using the same code base
>>>>> as
>>>>> a
>>>>> few co-workers of mine, but I'm the only one experiencing this issue.
>>>>>
>>>>> Has anyone come across this problem and can help me out?
>>>>>
>>>>> Much appreciated,
>>>>>
>>>>> John
>>
>