You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by pi...@yahoo.co.uk on 2004/11/16 12:51:28 UTC
problems with includes
high all
i am a newbie to this
i ran through some of the examples but i had problems, with servlets.
so then i switched to the velocitytools servlet
and that worked ok, for loading the templates and so on.
my question, can i include reference to images(like regyular html) in the
template?
i tried but it doesnt work.
then i tried to use includes.
i did a html page with images that works when viwed along
but when i try to include that in the template and then "render" the
template it is blank.
anyone can help me?
many thanks
chris
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Please unsubscribe me!
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi John,
> My email configuration has changed and I can't figure out how to
> unsubscribe.
>
> My old email was john@sfhypnosis.com
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
And send it from your old email.
## Also check the "Return-Path" header for the email you subscribed with.
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: problems with includes
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi christopher,
> if i use
> mywebapp
> |- META-INF
> |- WEB-INF
> |- templates
> |- images
> |- scripts
>
> then what do i use in my velocity properties?
> this is what i am using now
>
> #
> # we are taking advantage of the fact that the file
> # resource loader is the default loader
> #
>
> resource.loader = webapp
> webapp.resource.loader.description = Velocity Webapp Resource Loader
> webapp.resource.loader.class =
> org.apache.velocity.tools.view.servlet.WebappLoader
> webapp.resource.loader.path = /templates
webapp.resource.loader.path = /WEB-INF/templates
http://jakarta.apache.org/velocity/tools/javadoc/org/apache/velocity/tools/view/servlet/WebappLoader.html
In case you're using VelocityViewServlet, the "resource.loader" and
"webapp.resource.loader.class" are automatically set to these values.
;)
> this works with my directory layout. as you can see, i am trying to follow
> the directory structure recommend for jarkarta servelets etc
Just out of curiosity, where can I find documentaion on this?
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: problems with includes
Posted by pi...@yahoo.co.uk.
thanks
if i use
mywebapp
|- META-INF
|- WEB-INF
|- templates
|- images
|- scripts
then what do i use in my velocity properties?
this is what i am using now
#
# we are taking advantage of the fact that the file
# resource loader is the default loader
#
resource.loader = webapp
webapp.resource.loader.description = Velocity Webapp Resource Loader
webapp.resource.loader.class =
org.apache.velocity.tools.view.servlet.WebappLoader
webapp.resource.loader.path = /templates
this works with my directory layout. as you can see, i am trying to follow
the directory structure recommend for jarkarta servelets etc
thanks
christopher
----- Original Message -----
From: "Simon Christian" <si...@stoutstick.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Wednesday, November 17, 2004 7:21 AM
Subject: Re: problems with includes
> Shinobu Kawai wrote:
> > Hi christopher,
> >
> >
> >>what if i wanted to access another image in a subdir of mine..
> >>for example
> >>mywebapp
> >> web
> >> META-INF
> >> WEB-INF
> >> templates
> >> images
> >> src
> >> build
> >>
> >>i want to access the images in the image subdir of the templates
directory.
> >
> >
> >>> <img src="http://jakarta.apache.org/velocity/images/logo.gif" />
> >
> > Just change the URI in the src attribute to a relative path. You can
> > use the LikeTool to resolve relative paths.
> > http://jakarta.apache.org/velocity/tools/view/LinkTool.html
> >
> > You also need to configure your server to process static images, but
> > that's usually done by default. ;)
> >
> > Best regards,
> > -- Shinobu Kawai
> >
>
> Christopher,
>
> One caveat with this: the images directory shouldn't be within the
> WEB-INF folder at all as this isn't generally externally visible from
> the app server. The final (expanded) app structure could/should look
> something like:
>
> mywebapp
> |- META-INF
> |- WEB-INF
> |- templates
> |- images
> |- scripts
>
> You can then reference images or other resources relative to the
templates.
>
> hth
>
> - simon
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: problems with includes
Posted by Simon Christian <si...@stoutstick.com>.
Shinobu Kawai wrote:
> Hi christopher,
>
>
>>what if i wanted to access another image in a subdir of mine..
>>for example
>>mywebapp
>> web
>> META-INF
>> WEB-INF
>> templates
>> images
>> src
>> build
>>
>>i want to access the images in the image subdir of the templates directory.
>
>
>>> <img src="http://jakarta.apache.org/velocity/images/logo.gif" />
>
> Just change the URI in the src attribute to a relative path. You can
> use the LikeTool to resolve relative paths.
> http://jakarta.apache.org/velocity/tools/view/LinkTool.html
>
> You also need to configure your server to process static images, but
> that's usually done by default. ;)
>
> Best regards,
> -- Shinobu Kawai
>
Christopher,
One caveat with this: the images directory shouldn't be within the
WEB-INF folder at all as this isn't generally externally visible from
the app server. The final (expanded) app structure could/should look
something like:
mywebapp
|- META-INF
|- WEB-INF
|- templates
|- images
|- scripts
You can then reference images or other resources relative to the templates.
hth
- simon
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: problems with includes
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi christopher,
> what if i wanted to access another image in a subdir of mine..
> for example
> mywebapp
> web
> META-INF
> WEB-INF
> templates
> images
> src
> build
>
> i want to access the images in the image subdir of the templates directory.
> > <img src="http://jakarta.apache.org/velocity/images/logo.gif" />
Just change the URI in the src attribute to a relative path. You can
use the LikeTool to resolve relative paths.
http://jakarta.apache.org/velocity/tools/view/LinkTool.html
You also need to configure your server to process static images, but
that's usually done by default. ;)
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Please unsubscribe me!
Posted by John Rothfield <jo...@sfhypnosis.com>.
My email configuration has changed and I can't figure out how to
unsubscribe.
My old email was john@sfhypnosis.com
Thanks, John
707-538-5133
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: problems with includes
Posted by pi...@yahoo.co.uk.
thanks for your reply.
what if i wanted to access another image in a subdir of mine..
for example
mywebapp
web
META-INF
WEB-INF
templates
images
src
build
i want to access the images in the image subdir of the templates directory.
thanks
christopher
----- Original Message -----
From: "Shinobu Kawai" <sh...@gmail.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>;
<pi...@yahoo.co.uk>
Sent: Tuesday, November 16, 2004 7:58 AM
Subject: Re: problems with includes
> Hi chris,
>
> > my question, can i include reference to images(like regyular html) in
the
> > template?
> > i tried but it doesnt work.
> > then i tried to use includes.
> > i did a html page with images that works when viwed along
> > but when i try to include that in the template and then "render" the
> > template it is blank.
> Just do it like regular html. Put the following in your template, and
> you should see a wonderful image. :)
> <img src="http://jakarta.apache.org/velocity/images/logo.gif" />
>
> Best regards,
> -- Shinobu Kawai
>
> --
> Shinobu Kawai <sh...@gmail.com>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: problems with includes
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi chris,
> my question, can i include reference to images(like regyular html) in the
> template?
> i tried but it doesnt work.
> then i tried to use includes.
> i did a html page with images that works when viwed along
> but when i try to include that in the template and then "render" the
> template it is blank.
Just do it like regular html. Put the following in your template, and
you should see a wonderful image. :)
<img src="http://jakarta.apache.org/velocity/images/logo.gif" />
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org