From commits-return-3317-archive-asf-public=cust-asf.ponee.io@velocity.apache.org Tue Jun 26 12:21:08 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id C0A0A180636 for ; Tue, 26 Jun 2018 12:21:07 +0200 (CEST) Received: (qmail 18147 invoked by uid 500); 26 Jun 2018 10:21:06 -0000 Mailing-List: contact commits-help@velocity.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@velocity.apache.org Delivered-To: mailing list commits@velocity.apache.org Received: (qmail 18138 invoked by uid 99); 26 Jun 2018 10:21:06 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2018 10:21:06 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 3DB3F3A0141 for ; Tue, 26 Jun 2018 10:21:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1834413 - /velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext Date: Tue, 26 Jun 2018 10:21:05 -0000 To: commits@velocity.apache.org From: cbrisson@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20180626102106.3DB3F3A0141@svn01-us-west.apache.org> 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: