You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Charles N. Harvey III" <ch...@alloy.com> on 2002/04/05 03:59:09 UTC

velstruts

I finally decided to try out the velocity-struts merger.  The examples
are great and very clear.  There is only one bit that I don't get and
I'm sure its in a doc somewhere.

Where do the context variables come from?

When you look at a jsp page it has all that:
	<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
garbage.  But the .vm page has no such reference.  But it uses the same
variable names as the bean in the context.

<logic:present name="user">  ==  #if( $user )

So where did $user come from?  I have looked all through the source code
and there is not one context.put();.  So something is either happening
in the VelocityViewServlet or in a config file that I don't know about.
And how does it know which "taglibs" to use?


I have been trying to write my own controller for a while but don't really
trust myself.  So I have been experimenting with different MVC models.
>From ActionServlet to Struts to WebWork.  I like the simplicity of WebWork
but am having a hard time convincing others of its usefullness.  Same with
ActionServlet.  But since neither has the popularity of Struts I started
messing with the velstruts combination.  And it works basically the same
as WebWork - which is great.

I know I am asking two questions at once, but are there any opinions out
there
about which model is easiest?  It may not matter, I have some pretty rigid
(and faint of heart) people to convince.

Thanks again Velocitors!

Charlie


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: velstruts

Posted by Mark de Reeper <ma...@yahoo.com>.
The context variables magic is handled by the ChainedContext that is part of
the view tools, see org.apache.velocity.tools.view.context.ChainedContext. It
searches all of the scopes, applications, request, session as well as the
toolbox entries for the variable.

It is created in the VelocityViewServlet when the createContext is called.


--- "Charles N. Harvey III" <ch...@alloy.com> wrote:
> I finally decided to try out the velocity-struts merger.  The examples
> are great and very clear.  There is only one bit that I don't get and
> I'm sure its in a doc somewhere.
> 
> Where do the context variables come from?
> 
> When you look at a jsp page it has all that:
> 	<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> garbage.  But the .vm page has no such reference.  But it uses the same
> variable names as the bean in the context.
> 
> <logic:present name="user">  ==  #if( $user )
> 
> So where did $user come from?  I have looked all through the source code
> and there is not one context.put();.  So something is either happening
> in the VelocityViewServlet or in a config file that I don't know about.
> And how does it know which "taglibs" to use?
> 
> 
> I have been trying to write my own controller for a while but don't really
> trust myself.  So I have been experimenting with different MVC models.
> From ActionServlet to Struts to WebWork.  I like the simplicity of WebWork
> but am having a hard time convincing others of its usefullness.  Same with
> ActionServlet.  But since neither has the popularity of Struts I started
> messing with the velstruts combination.  And it works basically the same
> as WebWork - which is great.
> 
> I know I am asking two questions at once, but are there any opinions out
> there
> about which model is easiest?  It may not matter, I have some pretty rigid
> (and faint of heart) people to convince.
> 
> Thanks again Velocitors!
> 
> Charlie
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>