André van Toly wrote:
Op 5-jun-2007, om 13:11 heeft michiel boerman het volgende geschreven:
Hi, I'm trying to get a grip on mmbase so i might be bugging this
list with very 'newbie' questions...
Shoot :-)
the default scope for jspvars seems to be the enclosing mm:-tag. Is
there a way to extend this scope to -for instance- page?
Try this:
<mm:cloud>
<%-- 'default.mags' is the alias of the magazines node of the
MyNews example --%>
<mm:import externid="mag">default.mags</mm:import>
<mm:node number="$mag">
<h1><mm:field name="title" id="titleasid" /></h1>
</mm:node>
<h1><mm:write referid="titleasid" /></h1>
</mm:cloud>
As you can see the second <h1> contains the title of the magazines
example. For more information:
http://www.mmbase.org/docs/applications/taglib/frontenddevelopers/
taglib/taglib-tutorial.html
Also possible:
<h1>${titleasid}</h1>
---André
Notice here that the id attribute is used and not jspvar. id is similar
to the jstl var attribute. jspvar defines a java variable in the
compiled jsp. A java variable (jspvar) is limited to the java scoping
rules. The nice thing about the jsp expression language is that you can
use these java variables inside ${}. Nice side effect is that it is
scoped inside a tag which might be handy for lists. In mmbase 1.7 this
was useful, but in mmbase 1.8 the list-tags do the same thing for id
attributes.
Nico
_______________________________________________
Users mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/users