You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by stanlick <st...@gmail.com> on 2009/07/16 21:29:22 UTC
Plug-in creation and freemarker page location
I am working on a plug-in and having trouble getting the runtime to find my
freemarker pages. I have a folder named pages in my plugin.jar where my
freemarker pages reside. My struts-plugin.xml is referring to the pages as
follows:
<result type="freemarker">/pages/config.ftl</result>
However, I am receiving a runtime
java.io.FileNotFoundException: Template /config/pages/config.ftl not found.
at freemarker.template.Configuration.getTemplate(Configuration.java:489)
I have studied the struts2-config-browser-plugin and I'm now starting to
wonder if there is some magic with respect to the freemarker folder being
called config-browser which happens to be the same namespace of the plugin.
Does anyone know the mechanics of these names?
Peace,
Scott
--
View this message in context: http://www.nabble.com/Plug-in-creation-and-freemarker-page-location-tp24522925p24522925.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Plug-in creation and freemarker page location
Posted by stanlick <st...@gmail.com>.
I am using the leading "/" and it still seems to be using the namespace! I
renamed the ftl folder pages to be config to match the namespace, and it
works fine. Is there another way? I originally tried with and without the
leading slash and ultimately had to make this change to get it to work. I
was a little puzzled by this. Since it is a plug-in, I'd hate to require
additional configuration settings on the part of the developer. It should
be plug-n-play man!
P.S. By the way... which one's Pink?
Peace,
Scott
Musachy Barroso wrote:
>
> Well, actually I am wrong about that and yes, if there is no "/", it
> will use the namespace name:
>
> if (!locationArg.startsWith("/")) {
> ActionContext ctx = invocation.getInvocationContext();
> HttpServletRequest req = (HttpServletRequest)
> ctx.get(ServletActionContext.HTTP_REQUEST);
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
>
> musachy
>
> On Thu, Jul 16, 2009 at 3:36 PM, Musachy Barroso<mu...@gmail.com> wrote:
>> there is no magic there, remove the first "/" and give it a try.
>>
>> musachy
>>
>> On Thu, Jul 16, 2009 at 12:29 PM, stanlick<st...@gmail.com> wrote:
>>>
>>> I am working on a plug-in and having trouble getting the runtime to find
>>> my
>>> freemarker pages. I have a folder named pages in my plugin.jar where my
>>> freemarker pages reside. My struts-plugin.xml is referring to the pages
>>> as
>>> follows:
>>>
>>> <result type="freemarker">/pages/config.ftl</result>
>>>
>>> However, I am receiving a runtime
>>>
>>> java.io.FileNotFoundException: Template /config/pages/config.ftl not
>>> found.
>>> at
>>> freemarker.template.Configuration.getTemplate(Configuration.java:489)
>>>
>>> I have studied the struts2-config-browser-plugin and I'm now starting to
>>> wonder if there is some magic with respect to the freemarker folder
>>> being
>>> called config-browser which happens to be the same namespace of the
>>> plugin.
>>>
>>> Does anyone know the mechanics of these names?
>>>
>>> Peace,
>>> Scott
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Plug-in-creation-and-freemarker-page-location-tp24522925p24522925.html
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>>
>>
>> --
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Plug-in-creation-and-freemarker-page-location-tp24522925p24534468.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Plug-in creation and freemarker page location
Posted by Musachy Barroso <mu...@gmail.com>.
Well, actually I am wrong about that and yes, if there is no "/", it
will use the namespace name:
if (!locationArg.startsWith("/")) {
ActionContext ctx = invocation.getInvocationContext();
HttpServletRequest req = (HttpServletRequest)
ctx.get(ServletActionContext.HTTP_REQUEST);
String base = ResourceUtil.getResourceBase(req);
locationArg = base + "/" + locationArg;
}
musachy
On Thu, Jul 16, 2009 at 3:36 PM, Musachy Barroso<mu...@gmail.com> wrote:
> there is no magic there, remove the first "/" and give it a try.
>
> musachy
>
> On Thu, Jul 16, 2009 at 12:29 PM, stanlick<st...@gmail.com> wrote:
>>
>> I am working on a plug-in and having trouble getting the runtime to find my
>> freemarker pages. I have a folder named pages in my plugin.jar where my
>> freemarker pages reside. My struts-plugin.xml is referring to the pages as
>> follows:
>>
>> <result type="freemarker">/pages/config.ftl</result>
>>
>> However, I am receiving a runtime
>>
>> java.io.FileNotFoundException: Template /config/pages/config.ftl not found.
>> at freemarker.template.Configuration.getTemplate(Configuration.java:489)
>>
>> I have studied the struts2-config-browser-plugin and I'm now starting to
>> wonder if there is some magic with respect to the freemarker folder being
>> called config-browser which happens to be the same namespace of the plugin.
>>
>> Does anyone know the mechanics of these names?
>>
>> Peace,
>> Scott
>> --
>> View this message in context: http://www.nabble.com/Plug-in-creation-and-freemarker-page-location-tp24522925p24522925.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Plug-in creation and freemarker page location
Posted by Musachy Barroso <mu...@gmail.com>.
there is no magic there, remove the first "/" and give it a try.
musachy
On Thu, Jul 16, 2009 at 12:29 PM, stanlick<st...@gmail.com> wrote:
>
> I am working on a plug-in and having trouble getting the runtime to find my
> freemarker pages. I have a folder named pages in my plugin.jar where my
> freemarker pages reside. My struts-plugin.xml is referring to the pages as
> follows:
>
> <result type="freemarker">/pages/config.ftl</result>
>
> However, I am receiving a runtime
>
> java.io.FileNotFoundException: Template /config/pages/config.ftl not found.
> at freemarker.template.Configuration.getTemplate(Configuration.java:489)
>
> I have studied the struts2-config-browser-plugin and I'm now starting to
> wonder if there is some magic with respect to the freemarker folder being
> called config-browser which happens to be the same namespace of the plugin.
>
> Does anyone know the mechanics of these names?
>
> Peace,
> Scott
> --
> View this message in context: http://www.nabble.com/Plug-in-creation-and-freemarker-page-location-tp24522925p24522925.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org