Forwards to another page. The current page is disarded/not displayed.

Internally, a servlet RequestDispatcher is used for the forward. If a included file name is absolute (begins with a '/'), then it is relative to the servlet webapp, otherwiser it is relative to the current page.

As per the servlet API, if the response for this page has already been committed an exception will be thrown. Use/adjust page buffer sizes appropriately.


Include sections can appear anywhere in text sections.

[forward filename]
Quotes around the filename are optional.

The name of the forwarded file can contain expressions and hence be generated dynamically. For example:

[[ int i = 3; ]]
[forward 'foo[=i].html' ]
will forward to a file called foo3.html in the page.

Note: To forward to anothor page from within java code sections (for example, in cases of errors, missing parameters, etc.), use a servlet request dispatcher directly. For example:

    RequestDispatcher rd = req.getRequestDispatcher("/");
    rd.forward(req, res);
This is an area of improvement whereby we allow a variation of the the forward tag inside code sections as well, send me a patch if you can do this.


To prevent the tag from being recognized, this tag can be escaped by prefixing the start tag with a backslash: \[forward


An simple example of a forward. <html> <body> [forward page2.html] </body> </html> contents of page2.html