You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alberto Fernández <af...@easis.es> on 2013/04/07 17:44:29 UTC
getting context from java Class
Hi everybody,
>From .tml classes I can get my images url usring context. For example:
<img src="${context:}/CSS/images/modify.png" />
But now I need the context in my .java class
Are there a way to call context from here?
Thanks a lot
Re: getting context from java Class
Posted by Ivan Khalopik <ik...@gmail.com>.
If you need context path you can inject Request:
@Inject
private Request request;
public String getContextPath() {
return request.getContextPath()
}
On Mon, Apr 8, 2013 at 10:25 AM, Taha Hafeez Siddiqi <
tawus.tapestry@gmail.com> wrote:
>
> Hi
>
> You can use assets in your page using @Path annotation.
>
> @Inject
> @Path("context:images/tapestry_banner.gif")
> private Asset banner;
>
> Read more about it at
>
> http://tapestry.apache.org/assets.html
>
> regards
> Taha
>
> On 08-Apr-2013, at 12:28 PM, Alberto Fernández <af...@easis.es>
> wrote:
>
> > Context is already working on my .tml classes, but I would like to invoke
> > it from .java
> >
> > Alberto Fernández
> >
> > Consultoría Informática EASIS, SL <http://www.easis.es/>
> > Email: afernandez@easis.es <co...@easis.es>
> >
> >
> > 2013/4/7 Dmitry Gusev <dm...@gmail.com>
> >
> >> Hi,
> >>
> >> "context" is a binding prefix, your code should be:
> >>
> >> <img src="${context:CSS/images/modify.png}" />
> >>
> >> Look here:
> >> http://tapestry.apache.org/assets.html
> >>
> >>
> >>
> >> On Sun, Apr 7, 2013 at 7:44 PM, Alberto Fernández <afernandez@easis.es
> >>> wrote:
> >>
> >>> Hi everybody,
> >>>
> >>> From .tml classes I can get my images url usring context. For example:
> >>>
> >>> <img src="${context:}/CSS/images/modify.png" />
> >>>
> >>> But now I need the context in my .java class
> >>>
> >>> Are there a way to call context from here?
> >>>
> >>> Thanks a lot
> >>>
> >>
> >>
> >>
> >> --
> >> Dmitry Gusev
> >>
> >> AnjLab Team
> >> http://anjlab.com
> >>
>
>
--
BR
Ivan
Re: getting context from java Class
Posted by Taha Hafeez Siddiqi <ta...@gmail.com>.
Hi
You can use assets in your page using @Path annotation.
@Inject
@Path("context:images/tapestry_banner.gif")
private Asset banner;
Read more about it at
http://tapestry.apache.org/assets.html
regards
Taha
On 08-Apr-2013, at 12:28 PM, Alberto Fernández <af...@easis.es> wrote:
> Context is already working on my .tml classes, but I would like to invoke
> it from .java
>
> Alberto Fernández
>
> Consultoría Informática EASIS, SL <http://www.easis.es/>
> Email: afernandez@easis.es <co...@easis.es>
>
>
> 2013/4/7 Dmitry Gusev <dm...@gmail.com>
>
>> Hi,
>>
>> "context" is a binding prefix, your code should be:
>>
>> <img src="${context:CSS/images/modify.png}" />
>>
>> Look here:
>> http://tapestry.apache.org/assets.html
>>
>>
>>
>> On Sun, Apr 7, 2013 at 7:44 PM, Alberto Fernández <afernandez@easis.es
>>> wrote:
>>
>>> Hi everybody,
>>>
>>> From .tml classes I can get my images url usring context. For example:
>>>
>>> <img src="${context:}/CSS/images/modify.png" />
>>>
>>> But now I need the context in my .java class
>>>
>>> Are there a way to call context from here?
>>>
>>> Thanks a lot
>>>
>>
>>
>>
>> --
>> Dmitry Gusev
>>
>> AnjLab Team
>> http://anjlab.com
>>
Re: getting context from java Class
Posted by Alberto Fernández <af...@easis.es>.
Context is already working on my .tml classes, but I would like to invoke
it from .java
Alberto Fernández
Consultoría Informática EASIS, SL <http://www.easis.es/>
Email: afernandez@easis.es <co...@easis.es>
2013/4/7 Dmitry Gusev <dm...@gmail.com>
> Hi,
>
> "context" is a binding prefix, your code should be:
>
> <img src="${context:CSS/images/modify.png}" />
>
> Look here:
> http://tapestry.apache.org/assets.html
>
>
>
> On Sun, Apr 7, 2013 at 7:44 PM, Alberto Fernández <afernandez@easis.es
> >wrote:
>
> > Hi everybody,
> >
> > From .tml classes I can get my images url usring context. For example:
> >
> > <img src="${context:}/CSS/images/modify.png" />
> >
> > But now I need the context in my .java class
> >
> > Are there a way to call context from here?
> >
> > Thanks a lot
> >
>
>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com
>
Re: getting context from java Class
Posted by Dmitry Gusev <dm...@gmail.com>.
Hi,
"context" is a binding prefix, your code should be:
<img src="${context:CSS/images/modify.png}" />
Look here:
http://tapestry.apache.org/assets.html
On Sun, Apr 7, 2013 at 7:44 PM, Alberto Fernández <af...@easis.es>wrote:
> Hi everybody,
>
> From .tml classes I can get my images url usring context. For example:
>
> <img src="${context:}/CSS/images/modify.png" />
>
> But now I need the context in my .java class
>
> Are there a way to call context from here?
>
> Thanks a lot
>
--
Dmitry Gusev
AnjLab Team
http://anjlab.com