include

toc
<mm:include>

Does an include. This tag is rather similar to mm:url, but in stead of returning the url, it returns the page itself. In that respect it is also very similar to jsp:include. The advantage above jsp:include is that this tag is aware of the context parameters and knows the `param' sub tag.

mm:include also can be used to include `external' URLs, so you can `steal' from another server. But be aware that this causes your server to do an http-request itself to another server. It depends on your server's configuration and of its network's setup, if it is allowed to do this.

If this version of MMBase is running on the Orion application server even `internal' URLs, so pointing to files on the same server, will work like this. In other words, Orion will do an http-request to itself. This was the way the include-tag worked always in MMBase 1.5.

You can also consider using the jsp <%@include file="" %>. This will include the code of that page in place and compile it together with your page. So in that aspect it is much different from this tag, which "includes" a stand-alone page. Using the `context' tag you can still give this included file its own scope.

Also 'tagfiles' provide a nice way to make pieces of taglib code generic.

See JSP Syntax Reference

See MMBase documentation on include mechanisms in MMBase taglib..

see alsoparam | url | haspage | treeinclude | leafinclude
attributes
  • referids
    see: referids attribute of url
  • page
    see: page attribute of url
  • component
    see: component attribute of url
  • referid
    see: referid attribute of url
  • debug
    For debugging you can print the used URL in the page as comments..
    noneNo debugging on the page (default)
    htmlUse html comments
    xmlUse XML comments
    cssUse css comments
  • cite
    Whether to `cite' the page. This only works for `relative' urls on the same server. Only also if you have sufficiently rights to do that. Citing means that the page is acquired directly, so without interpreting/compiling by the web-server. Mainly useful for documentation of page-creating/taglib itself.
  • encoding (since: MMBase-1.7.1)
    The encoding of the to-be-included page. If the included page does provide the right information about this, then there should be no need to use this attribute ever. But if it fails, then you can explicitly try to repair it, using this attribute.
  • attributes (since: MMBase-1.7.4)
    Like 'referids', but sets the variables as request attributes.
    see: from attribute of import | request attribute of write
  • notfound (since: MMBase-1.8)
    Specify the behaviour when the file cannot be found. Default is 'message', but you can change this to give an exception for non-existing files that are included.
    skipDo not generate any error if the file cannot be found
    messageJust write a message to the page if the resource could not be found
    exceptionRaise an exception if the file cannot be found
    log Log a warning if the file cannot be found
  • resource (since: MMBase-1.8)
    Specifies any resource relative to the WebRoot ResourceLoader to be included. This is more or less equivalent to using cite="true", and using page="..". The only difference is that, when using this, there are no restrictions (so you can also show resources in WEB-INF). So, never use this with user input.
  • timeout (since: MMBase-1.9)
    For 'external' includes you can indicate a 'timeout' in milliseconds. A _responseCode variable will be produced.
writer attributes
example 1
<mm:include page="codesamples/index.jsp.1" />
    
example 2
      <os:cache>
        <mm:include page="http://site.which.sometimes.does.not.work.com" timeout="200" />
        <c:if test="true">
          <os:usecached />
        </c:if>
      </os:cache>