Technical Corner

An error occurred while processing the template.
Denied access to method or field getParameter of class org.apache.catalina.core.ApplicationHttpRequest

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #if request.getParameter("articlesCou...  [in template "20102#20129#1082937" at line 17, column 1]
----
1<#assign 
2layouts = themeDisplay.getLayouts() 
3local = themeDisplay.getLocale() 
4layoutLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService") 
5extendedSeq = [] 
6reducedLayoutsList = [] 
7articlesCount = 0 
8articlesInternalLoopCount = 0 
9articlesInternalCount = 0 
10isArticlesHomepage = false 
11isArticleCategoryPage = false 
12isArticleSubcategoryPage = false> 
13<#-- set locale for freemarker date otherwise months are not translated in the current language --> 
14<#setting locale= local> 
15 
16<#-- get the articles count parameter from the url or loop to find the number of articles --> 
17<#if request.getParameter("articlesCount")?has_content> 
18    <#assign articlesCount = request.getParameter("articlesCount")?number> 
19    <#if layout.getFriendlyURL(local)?split("/")?size == 5> 
20        <#assign isArticleSubcategoryPage = true> 
21    <#elseif layout.getFriendlyURL(local)?split("/")?size == 4> 
22        <#assign isArticleCategoryPage = true> 
23    <#elseif layout.getFriendlyURL(local)?split("/")?size == 3> 
24        <#assign isArticlesHomepage = true> 
25    </#if> 
26<#else> 
27    <#list layouts as mainpage> 
28        <#if mainpage.getFriendlyURL(local) == '/blog'  && 
29        layout.getFriendlyURL(local)?starts_with('/blog')> 
30            <#list mainpage.getChildren() as homeSubPages> 
31                <#if homeSubPages.getFriendlyURL(local) == '/blog/articles'> 
32                    <#list homeSubPages.getChildren() as categoriesBlogPages> 
33                    <#-- if the layout split by slash has a size of 4 meaning 
34                         it's categories page ( /blog/articles/categories )  --> 
35                        <#if layout.getFriendlyURL(local)?split("/")?size == 4 && 
36                        layout.getFriendlyURL(local) == categoriesBlogPages.getFriendlyURL(local)> 
37                            <#assign isArticleCategoryPage = true> 
38                            <#list categoriesBlogPages.getChildren() as subCategoriesBlogPages> 
39                                <#list subCategoriesBlogPages.getChildren() as articles> 
40                                    <#assign articlesCount = articlesCount + 1 /> 
41                                </#list> 
42                            </#list> 
43                        <#-- if the layout split by slash has a size of 5 meaning 
44                             it's subcategories page ( /blog/articles/categories/subcategories )  --> 
45                        <#elseif layout.getFriendlyURL(local)?split("/")?size == 5> 
46                            <#list categoriesBlogPages.getChildren() as subCategoriesBlogPages> 
47                                <#assign isArticleSubcategoryPage = true> 
48                                <#if layout.getFriendlyURL(local)?split("/")?size == 5 && 
49                                layout.getFriendlyURL(local) == subCategoriesBlogPages.getFriendlyURL(local)> 
50                                    <#list subCategoriesBlogPages.getChildren() as articles> 
51                                        <#assign articlesCount = articlesCount + 1 /> 
52                                    </#list> 
53                                </#if> 
54                            </#list> 
55                        <#-- if the layout split by slash has a size of 3 meaning 
56                             it's article home page ( /blog/articles )  --> 
57                        <#elseif layout.getFriendlyURL(local)?split("/")?size == 3> 
58                            <#assign isArticlesHomepage = true> 
59                            <#list categoriesBlogPages.getChildren() as subCategoriesBlogPages> 
60                                <#list subCategoriesBlogPages.getChildren() as articles> 
61                                    <#assign articlesCount = articlesCount + 1 /> 
62                                </#list> 
63                            </#list> 
64                        </#if> 
65                    </#list> 
66                </#if> 
67            </#list> 
68        </#if> 
69    </#list> 
70</#if> 
71 
72<#-- set the pagesMaxNumber with the ArticlesDisplayNumber per page set in the webcontent --> 
73<#assign articlesNumber = articlesCount/ArticlesDisplayNumber.getData()?number 
74         pagesMaxNumber = articlesNumber?string["0;; roundingMode=up groupingSeparator=_"]?number/> 
75 
76<#-- get the page parameter from the url or put default page number (1) --> 
77<#if (request.getParameter("page")?has_content)> 
78    <#if request.getParameter("page")?number gt pagesMaxNumber> 
79        <#assign pageNumber = 1> 
80    <#else> 
81        <#assign pageNumber = request.getParameter("page")?number> 
82    </#if> 
83<#else> 
84    <#assign pageNumber = 1> 
85</#if> 
86 
87<#list layouts as mainpage> 
88    <#if mainpage.getFriendlyURL(local) == '/blog'  && 
89    layout.getFriendlyURL(local)?starts_with('/blog')> 
90        <#list mainpage.getChildren() as articlesBlogPages> 
91            <#if articlesBlogPages.getFriendlyURL(local) == '/blog/articles'> 
92            <#-- CASE HOMEPAGE ARTICLE --> 
93                <#if isArticlesHomepage> 
94                    <#list articlesBlogPages.getChildren() as categoriesBlogPages> 
95                        <#list categoriesBlogPages.getChildren() as subCategoriesBlogPages> 
96                            <#if subCategoriesBlogPages.getChildren()??> 
97                                <#list subCategoriesBlogPages.getChildren() as articleElement> 
98                                    <#attempt> 
99                                        <#assign 
100                                        dateArticle = articleElement.getExpandoBridge().getAttribute('Blog display date from') 
101                                        articlePageHash = {"date": dateArticle?datetime, 
102                                        "article": articleElement, 
103                                        "categoryName": categoriesBlogPages.getHTMLTitle(local), 
104                                        "categoryUrl": categoriesBlogPages.getRegularURL(request), 
105                                        "subCategoryName": subCategoriesBlogPages.getHTMLTitle(local), 
106                                        "subCategoryUrl": subCategoriesBlogPages.getRegularURL(request)} 
107                                        extendedSeq += [articlePageHash]> 
108                                        <#recover> 
109                                    </#attempt> 
110                                </#list> 
111                            </#if> 
112                        </#list> 
113                    </#list> 
114                <#-- CASE HOMEPAGE CATEGORIES --> 
115                <#elseif isArticleCategoryPage> 
116                    <#list articlesBlogPages.getChildren() as categoriesBlogPages> 
117                        <#if layout.getFriendlyURL(local) == categoriesBlogPages.getFriendlyURL(local)> 
118                            <#list categoriesBlogPages.getChildren() as subCategoriesBlogPages> 
119                                <#if subCategoriesBlogPages.getChildren()??> 
120                                    <#list subCategoriesBlogPages.getChildren() as articleElement> 
121                                        <#attempt> 
122                                            <#assign 
123                                            dateArticle = articleElement.getExpandoBridge().getAttribute('Blog display date from') 
124                                            articlePageHash = {"date": dateArticle?datetime, 
125                                            "article": articleElement, 
126                                            "categoryName": categoriesBlogPages.getHTMLTitle(local), 
127                                            "categoryUrl": categoriesBlogPages.getRegularURL(request), 
128                                            "subCategoryName": subCategoriesBlogPages.getHTMLTitle(local), 
129                                            "subCategoryUrl": subCategoriesBlogPages.getRegularURL(request)} 
130                                            extendedSeq += [articlePageHash]> 
131                                            <#recover> 
132                                        </#attempt> 
133                                    </#list> 
134                                </#if> 
135                            </#list> 
136                        </#if> 
137                    </#list> 
138                <#-- CASE HOMEPAGE SUBCATEGORIES --> 
139                <#elseif isArticleSubcategoryPage> 
140                    <#list articlesBlogPages.getChildren() as categoriesBlogPages> 
141                        <#list categoriesBlogPages.getChildren() as subCategoriesBlogPages> 
142                            <#if layout.getFriendlyURL(local) == subCategoriesBlogPages.getFriendlyURL(local)> 
143                                <#if subCategoriesBlogPages.getChildren()??> 
144                                    <#list subCategoriesBlogPages.getChildren() as articleElement> 
145                                        <#attempt> 
146                                            <#assign 
147                                            dateArticle = articleElement.getExpandoBridge().getAttribute('Blog display date from') 
148                                            articlePageHash = {"date": dateArticle?datetime, 
149                                            "article": articleElement, 
150                                            "categoryName": categoriesBlogPages.getHTMLTitle(local), 
151                                            "categoryUrl": categoriesBlogPages.getRegularURL(request), 
152                                            "subCategoryName": subCategoriesBlogPages.getHTMLTitle(local), 
153                                            "subCategoryUrl": subCategoriesBlogPages.getRegularURL(request)} 
154                                            extendedSeq += [articlePageHash]> 
155                                            <#recover> 
156                                        </#attempt> 
157                                    </#list> 
158                                </#if> 
159                            </#if> 
160                        </#list> 
161                    </#list> 
162                </#if> 
163            </#if> 
164        </#list> 
165    </#if> 
166</#list> 
167 
168<#assign sortedListPagesByDate = extendedSeq?sort_by("date")?reverse> 
169 
170<#list sortedListPagesByDate as pages> 
171    <#assign articlesInternalLoopCount = articlesInternalLoopCount +1 
172             pageInternalLoopCount = articlesInternalLoopCount/ArticlesDisplayNumber.getData()?number> 
173    <#-- if page number counter superior or equal to the page number 
174       => if articles display = 3 and articlesInternalLoopCount = 5, we are page 2 
175       and the number of articles lower or equal to the limit of articles display  --> 
176    <#if pageInternalLoopCount?string["0;; roundingMode=ceiling groupingSeparator=_"]?number gte pageNumber && 
177        articlesInternalCount lt ArticlesDisplayNumber.getData()?number> 
178        <#assign articlesInternalCount = articlesInternalCount +1> 
179        <#attempt> 
180            <#assign 
181            authorPageUrl = pages.article.getExpandoBridge().getAttribute('Blog author page url') 
182            authorTruncatedUrl = "/blog" + authorPageUrl?keep_after("/blog") 
183            authorPage = layoutLocalService.getFriendlyURLLayout(groupId, false, authorTruncatedUrl) 
184            authorImage = authorPage.getExpandoBridge().getAttribute('Blog image url') 
185            articleImage = pages.article.getExpandoBridge().getAttribute('Blog image url') 
186            <#-- insert the article required data inside the hash --> 
187            articlePagesHash = {"date": pages.date?datetime, "friendlyUrl": pages.article.getFriendlyURL(local), 
188            "categoryName": pages.categoryName, "categoryUrl": pages.categoryUrl, 
189            "subCategoryName": pages.subCategoryName, "subCategoryUrl": pages.subCategoryUrl, 
190            "articleImage": articleImage, "articleTitle": pages.article.getHTMLTitle(local), 
191            "articleDescription": pages.article.getDescription(local), "authorName": authorPage.getHTMLTitle(local), 
192            "authorFriendlyUrl": authorPage.getRegularURL(request), "authorImage": authorImage} 
193            reducedLayoutsList += [articlePagesHash]> 
194            <#recover> 
195        </#attempt> 
196    </#if> 
197</#list> 
198 
199 
200<div class="items"> 
201    <#list reducedLayoutsList as articles> 
202        <div class="card card-article card-article-medium 
203            <#if articles?index gt (ArticlesDisplayNumber.getData()?number - 1)>more</#if>" 
204                <#if articles?index gt (ArticlesDisplayNumber.getData()?number - 1) > style="display: none"</#if>> 
205            <div class="card-wrapper"> 
206                <div class="row"> 
207                    <div class="col-lg-6 order-lg-2"> 
208                        <div class="card-img-wrapper"> 
209                            <a data-senna-off="true" href="${articles.friendlyUrl}" <#if ArticleLinkLabel.ArticleLinkAriaLabel?? && 
210                                ArticleLinkLabel.ArticleLinkAriaLabel?has_content && 
211                                ArticleLinkLabel.ArticleLinkAriaLabel.getData()?has_content> 
212                                aria-label="${ArticleLinkLabel.ArticleLinkAriaLabel.getData()} ${articles.articleTitle}"</#if>> 
213                                <img src="${articles.articleImage}" class="img-fluid object-fit" <#if ArticleLinkLabel.ArticleLinkAriaLabel?? && 
214                                ArticleLinkLabel.ArticleLinkAriaLabel?has_content && 
215                                ArticleLinkLabel.ArticleLinkAriaLabel.getData()?has_content>alt=""</#if>> 
216                            </a> 
217                        </div> 
218                    </div> 
219                    <div class="col-lg-6 order-lg-1"> 
220                        <div class="card-text-wrapper"> 
221                            <div class="badge-wrapper"> 
222                                <a data-senna-off="true" href="${articles.categoryUrl}" class="badge badge-small badge-blue-business " 
223                                    <#if TagAriaLabel?? && TagAriaLabel?has_content && 
224                                    TagAriaLabel.getData()?has_content> 
225                                    aria-label="${TagAriaLabel.getData()} ${articles.categoryName}"</#if>> 
226                                    ${articles.categoryName} 
227                                </a> 
228                                <a data-senna-off="true" href="${articles.subCategoryUrl}" 
229                                    <#if TagAriaLabel?? && TagAriaLabel?has_content && 
230                                    TagAriaLabel.getData()?has_content> 
231                                    aria-label="${TagAriaLabel.getData()} ${articles.subCategoryName}"</#if> 
232                                    class="badge badge-small badge-blue-business "> 
233                                    ${articles.subCategoryName} 
234                                </a> 
235                            </div> 
236 
237                            <h2><a data-senna-off="true" href="${articles.friendlyUrl}">${articles.articleTitle}</a></h2> 
238                            <p>${articles.articleDescription}</p> 
239                            <a data-senna-off="true" href="${articles.friendlyUrl}" class="btn btn-link" 
240                                <#if ArticleLinkLabel.ArticleLinkAriaLabel?? && 
241                                ArticleLinkLabel.ArticleLinkAriaLabel?has_content && 
242                                ArticleLinkLabel.ArticleLinkAriaLabel.getData()?has_content> 
243                                aria-label="${ArticleLinkLabel.ArticleLinkAriaLabel.getData()} ${ArticleLinkLabel.getData()}"</#if>> 
244                                ${ArticleLinkLabel.getData()}<i class="icon-chevron-right"></i> 
245                            </a> 
246                        </div> 
247 
248                        <div class="card-details-wrapper"> 
249                            <div class="author"> 
250                                <div class="author-img-wrapper"> 
251                                    <img src="${articles.authorImage}" class="img-fluid object-fit" alt=""> 
252                                </div> 
253                                <div> 
254                                    <p class="title">${AuthorLabel.getData()}</p> 
255                                    <a data-senna-off="true" href="${articles.authorFriendlyUrl}" 
256                                       class="value stretched-link" 
257                                        <#if AuthorLabel.AuthorAriaLabel?? && 
258                                        AuthorLabel.AuthorAriaLabel?has_content && 
259                                        AuthorLabel.AuthorAriaLabel.getData()?has_content> 
260                                        aria-label="${AuthorLabel.AuthorAriaLabel.getData()} ${articles.authorName}"</#if>> 
261                                        ${articles.authorName} 
262                                    </a> 
263                                </div> 
264                            </div> 
265                            <div class="date"> 
266                                <p class="title">${PublicationLabel.getData()}</p> 
267                                <p class="value">${articles.date?string["dd MMMM yyyy"]}</p> 
268                            </div> 
269                        </div> 
270                    </div> 
271                </div> 
272            </div> 
273        </div> 
274    </#list> 
275</div> 
276 
277<nav aria-label="pagination"> 
278    <ul class="pagination"> 
279        <#if PreviousPageLabel?? && PreviousPageLabel.getData()?has_content> 
280            <li class="page-item <#if pageNumber == 1>disabled</#if>"> 
281                <a class="page-link" <#if pageNumber == 1>href="#" <#else> href="?page=${pageNumber-1}&articlesCount=${articlesCount}"</#if>> 
282                    <i class="icon-chevron-left"></i> 
283                    <span>${PreviousPageLabel.getData()}</span> 
284                </a> 
285            </li> 
286        </#if> 
287 
288        <li class="page-item <#if pageNumber == 1>active</#if>"> 
289            <a class="page-link" href="?page=1&articlesCount=${articlesCount}">1</a> 
290        </li> 
291 
292        <#-- Less than 4 articles pages  --> 
293        <#if pageNumber lt 4> 
294            <#if pagesMaxNumber gt 1> 
295                <li class="page-item <#if pageNumber == 2>active</#if>"> 
296                    <a class="page-link" href="?page=2&articlesCount=${articlesCount}">2</a> 
297                </li> 
298            </#if> 
299            <#if pagesMaxNumber gt 2> 
300                <li class="page-item <#if pageNumber == 3>active</#if>"> 
301                    <a class="page-link" href="?page=3&articlesCount=${articlesCount}">3</a> 
302                </li> 
303            </#if> 
304            <#if pagesMaxNumber gt 3> 
305                <li class="page-item <#if pageNumber == 4>active</#if>"> 
306                    <a class="page-link" href="?page=4&articlesCount=${articlesCount}">4</a> 
307                </li> 
308            </#if> 
309            <#if pagesMaxNumber gt 4> 
310                <li class="page-item page-dots">...</li> 
311                <li class="page-item"> 
312                    <a class="page-link" href="?page=${pagesMaxNumber}&articlesCount=${articlesCount}">${pagesMaxNumber}</a> 
313                </li> 
314            </#if> 
315        </#if> 
316 
317        <#-- Handle the previous pages when the active page is the pagesMaxNumber and pagesMaxNumber is 4 --> 
318        <#if pageNumber == pagesMaxNumber && pageNumber == 4> 
319            <li class="page-item"> 
320                <a class="page-link" href="?page=2&articlesCount=${articlesCount}">2</a> 
321            </li> 
322            <li class="page-item"> 
323                <a class="page-link" href="?page=3&articlesCount=${articlesCount}">3</a> 
324            </li> 
325            <li class="page-item active"> 
326                <a class="page-link" href="?page=${pagesMaxNumber}&articlesCount=${articlesCount}">${pagesMaxNumber}</a> 
327            </li> 
328        </#if> 
329 
330        <#-- More than 4 pages, handle the pages between the first and the last one : 1 ... 4 5 6 ... 18  --> 
331        <#if pageNumber gte 4 && pageNumber lt pagesMaxNumber-1> 
332            <li class="page-item page-dots">...</li> 
333            <li class="page-item "> 
334                <a class="page-link" href="?page=${pageNumber-1}&articlesCount=${articlesCount}">${pageNumber-1}</a> 
335            </li> 
336            <li class="page-item active"> 
337                <a class="page-link" href="?page=${pageNumber}&articlesCount=${articlesCount}">${pageNumber}</a> 
338            </li> 
339            <li class="page-item "> 
340                <a class="page-link" href="?page=${pageNumber+1}&articlesCount=${articlesCount}">${pageNumber+1}</a> 
341            </li> 
342            <li class="page-item page-dots">...</li> 
343            <li class="page-item"> 
344                <a class="page-link" href="?page=${pagesMaxNumber}&articlesCount=${articlesCount}">${pagesMaxNumber}</a> 
345            </li> 
346        </#if> 
347 
348        <#-- Handle the last pages when the active page is not the last : 1 ... 16 17 18  --> 
349        <#if pagesMaxNumber gt 4 && pageNumber lt pagesMaxNumber && pageNumber gte pagesMaxNumber-1> 
350            <li class="page-item page-dots">...</li> 
351            <li class="page-item"> 
352                <a class="page-link" href="?page=${pageNumber-1}&articlesCount=${articlesCount}">${pageNumber-1}</a> 
353            </li> 
354            <li class="page-item active"> 
355                <a class="page-link" href="?page=${pageNumber}&articlesCount=${articlesCount}">${pageNumber}</a> 
356            </li> 
357            <li class="page-item"> 
358                <a class="page-link" href="?page=${pagesMaxNumber}&articlesCount=${articlesCount}">${pagesMaxNumber}</a> 
359            </li> 
360        </#if> 
361 
362        <#-- Handle the last pages when the active page is not the last : 1 ... 16 17 18  --> 
363        <#if pageNumber == pagesMaxNumber && pageNumber gt 4> 
364            <li class="page-item page-dots">...</li> 
365            <li class="page-item"> 
366                <a class="page-link" href="?page=${pageNumber-2}&articlesCount=${articlesCount}">${pageNumber-2}</a> 
367            </li> 
368            <li class="page-item"> 
369                <a class="page-link" href="?page=${pageNumber-1}&articlesCount=${articlesCount}">${pageNumber-1}</a> 
370            </li> 
371            <li class="page-item active"> 
372                <a class="page-link" href="?page=${pagesMaxNumber}&articlesCount=${articlesCount}">${pagesMaxNumber}</a> 
373            </li> 
374        </#if> 
375 
376        <#if NextPageLabel?? && NextPageLabel.getData()?has_content> 
377            <li class="page-item <#if pageNumber == pagesMaxNumber>disabled</#if>"> 
378                <a class="page-link" <#if pageNumber == pagesMaxNumber>href="#" <#else> href="?page=${pageNumber+1}&articlesCount=${articlesCount}"</#if>> 
379                    <span>${NextPageLabel.getData()}</span> 
380                    <i class="icon-chevron-right"></i> 
381                </a> 
382            </li> 
383        </#if> 
384    </ul> 
385</nav> 

Contact us

Do you have any questions about an article? Do you need help solving your IT issues? 

Contact an expert

Our experts answer your questions

Do you have any questions about an article? Do you need help solving your IT issues?