Hi Hristo From: <[EMAIL PROTECTED]> > > Hi James! > I am trying to partition my scripts, but <j:include uri="..." /> > does not import the context of the parent script. How can > I make the parent script variables visible in the included > script?
A few folks have been mailing me about this one lately so I thought I'd reply via commons-dev. I've recently patched the code so that the JellyContext is available in the expression language as a variable called "context". There's a helper method on this to find a variable value in the current context or any parent context. So you can do things like this... <j:set var="x" value='${context.findVariable("something")}'/> Which would look in this script, the parent script, or its parent and so forth until its found, or null is returned. Or you could explicitly use the getParent() property of JellyContext to go up 1, 2, 3, ..., levels to outer scripts. e.g. <j:set var="x" value='${context.parent.getVariable("something")}'/> <j:set var="x" value='${context.parent.parent.getVariable("something")}'/> It might be nice to implement a Jelly function, like <j:if test="${findVariable('foo') == 'bar'}"> ... which would be less of a mouthful to type. When Jelly is deployed in a Servlet engine I suspect it would be prudent to make all standard varable scopes available in the variable context like JSTL does. So there'll be implict objects pageScope, requestScope, sessionScope, applicationScope, paramScope, initParamScope etc. e.g. <j:if test="${sessionScope.userId == paramScope.user}"> ... James _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>