Author: cbrisson
Date: Tue Jun 26 10:21:05 2018
New Revision: 1834413
URL: http://svn.apache.org/viewvc?rev=1834413&view=rev
Log:
[site/tools] Update VelocityLayoutServlet doc
Modified:
velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext
Modified: velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext
URL:
http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext?rev=1834413&r1=1834412&r2=1834413&view=diff
==============================================================================
--- velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext
(original)
+++ velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext Tue
Jun 26 10:21:05 2018
@@ -52,13 +52,24 @@ This saves you the trouble of doing the
## Alternative Layouts
-VLS provides two ways to specify an alternate template for a requested page:
+VLS provides several ways to specify an alternate template for a requested
page:
-1. **Specify the layout in the request parameters**
-
-Just add the query string "layout=MyOtherLayout.vm" to any request params and
the VLS will find it and render your screen within that layout instead of the
default layout. It don't matter how you get the layout param into the query
data, only that it's there.
+1. **Specify the layout in the request attribute**
-2. **Specify the layout in the requested screen.**
+ :::java
+ request.setAttribute("layout", "MyOtherLayout.vm");
+
+2. **Specify the layout by overloading the
`VelocityLayoutServlet.findLayout(HttpServletRequest)` function**
+
+ :::java
+ @Override
+ public String findLayout(HttpServletRequest request)
+ {
+ if (request.getParameter("change_layout") != null) return
"MyOtherLayout.vm";
+ else return super.findLayout(request)
+ }
+
+3. **Specify the layout in the requested screen.**
In the requested screen, put a line like this: