You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by j alex <st...@gmail.com> on 2007/08/27 23:09:55 UTC

S2 / FTL : Getting application params in FTL

Hi,

How do i access params defined in web.xml in the FTL ? ; In my app, all the
images are located at a particular path which is defined as

    <context-param>
        <param-name>GLOBAL_IMAGES_ROOT</param-name>
        <param-value>www/abc/def/images</param-value>
    </context-param>

and i want to show an icon from this directory within the FTL . How would i
make GLOBAL_IMAGES_ROOT available to the FTL markup?

<img src="${Application.LOCAL_JS_ROOT}/icon.gif"> does not work

Please help,
Joseph

Re: S2 / FTL : Getting application params in FTL

Posted by j alex <st...@gmail.com>.
It turned out to be as simple as <img
src="${application.GLOBAL_IMAGES_ROOT}/icon.gif">
..thanks to case sensitivity :-) , oops - i just noticed the code i pasted
was messed up but as you would have guessed it was a typo

On 8/28/07, Laurie Harper <la...@holoweb.net> wrote:
>
> j alex wrote:
> > Hi,
> >
> > How do i access params defined in web.xml in the FTL ? ; In my app, all
> the
> > images are located at a particular path which is defined as
> >
> >     <context-param>
> >         <param-name>GLOBAL_IMAGES_ROOT</param-name>
> >         <param-value>www/abc/def/images</param-value>
> >     </context-param>
> >
> > and i want to show an icon from this directory within the FTL . How
> would i
> > make GLOBAL_IMAGES_ROOT available to the FTL markup?
> >
> > <img src="${Application.LOCAL_JS_ROOT}/icon.gif"> does not work
>
> You'll need to have some code somewhere to copy the context parameters
> defined in web.xml into application scope. Servlet context parameters
> aren't automatically put anywhere accessible via OGNL.
>
> Also, it'd help to use the same name when defining and accessing the
> constant ;-)
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: S2 / FTL : Getting application params in FTL

Posted by Laurie Harper <la...@holoweb.net>.
j alex wrote:
> Hi,
> 
> How do i access params defined in web.xml in the FTL ? ; In my app, all the
> images are located at a particular path which is defined as
> 
>     <context-param>
>         <param-name>GLOBAL_IMAGES_ROOT</param-name>
>         <param-value>www/abc/def/images</param-value>
>     </context-param>
> 
> and i want to show an icon from this directory within the FTL . How would i
> make GLOBAL_IMAGES_ROOT available to the FTL markup?
> 
> <img src="${Application.LOCAL_JS_ROOT}/icon.gif"> does not work

You'll need to have some code somewhere to copy the context parameters 
defined in web.xml into application scope. Servlet context parameters 
aren't automatically put anywhere accessible via OGNL.

Also, it'd help to use the same name when defining and accessing the 
constant ;-)

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org