You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Craig Christophersen <cr...@synesis7.com> on 2004/04/20 01:13:27 UTC

#parse in Frames

Hello:
I am having trouble passing a template to be parsed in an html frame. Such
as if I have #set ($docText = docText.vm) then  within the frameset tag I
have tried all I can think of. <frame src="#parse($docText)" > is one
example.
I mainly get "the requested resourse is not available" 404 error page.
The .vm templates are in the webapp/appname folder correctly.  If  I just
call the child frame template directly from the VelocityServlet it works
fine.  Just in Frames that I am having this problem.  Any help out there on
using the #parse tag from within Frames?
Thank you,
Craig Christophersen
Software Developer
(406)533-6750
craigch@synesis7.com


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


Re: #parse in Frames

Posted by Claude Brisson <cl...@renegat.net>.
Some misconception on your side here...
The src argument of a frame must be an url, not the content of a file, which is what the result of a #parse is.
Be sure to understand what happens on the client side or on the server side, drawing a little diagram for yourself can help.

I would guess that in your case, you don't need #parse : just specify the address for the child frame template as the src argument :
<frame src="docText.vm" >

and it should work.

CloD

----- Original Message ----- 
From: "Craig Christophersen" <cr...@synesis7.com>
To: <ve...@jakarta.apache.org>
Sent: Tuesday, April 20, 2004 1:13 AM
Subject: #parse in Frames


> Hello:
> I am having trouble passing a template to be parsed in an html frame. Such
> as if I have #set ($docText = docText.vm) then  within the frameset tag I
> have tried all I can think of. <frame src="#parse($docText)" > is one
> example.
> I mainly get "the requested resourse is not available" 404 error page.
> The .vm templates are in the webapp/appname folder correctly.  If  I just
> call the child frame template directly from the VelocityServlet it works
> fine.  Just in Frames that I am having this problem.  Any help out there on
> using the #parse tag from within Frames?
> Thank you,
> Craig Christophersen
> Software Developer
> (406)533-6750
> craigch@synesis7.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: #parse in Frames

Posted by Christoph Reck <ap...@recks.org>.
Craig Christophersen wrote:
> Hello:
> I am having trouble passing a template to be parsed in an html frame. Such
> as if I have #set ($docText = docText.vm) then  within the frameset tag I
> have tried all I can think of. <frame src="#parse($docText)" > is one
> example.

Consider using servlet sessions and use the session context to place values
to be reused later. Check the servlet APIdoc for the methods, out of my mind:

$request.session.setAttribute("foo", "bar")

and later on:

$request.session.getAttribute('foo')

Be aware that such things may cause funny side effects if the user uses
the browser "back" button and reloads a page where currently the session
holds an inconsitent value for that frameset.

The proper way is to either use the PATH_INFO (create the url in the
frameset page) or specific application action code (à la Struts).

> I mainly get "the requested resourse is not available" 404 error page.
> The .vm templates are in the webapp/appname folder correctly.  If  I just
> call the child frame template directly from the VelocityServlet it works
> fine.  Just in Frames that I am having this problem.  Any help out there on
> using the #parse tag from within Frames?

Als beware of hackers, where users could modify the url and try to
access other resources (in your case the resource loader would allow
loading anyting under webapp/appname).

> Thank you,
> Craig Christophersen
> Software Developer
> (406)533-6750
> craigch@synesis7.com

I strongly reccomend to move to the velocity-tools VelocityViewServlet
once this uses the non-singleton engine.

Hope this helped.

Cheers,
Christoph



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