类别导航

处理模板时发生错误。
The following has evaluated to null or missing:
==> serviceLocator.findService("com.liferay.portlet.asset.service.AssetCategoryService")  [in template "20116#20152#31497" at line 34, column 81]

----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign assetCategoryService = servic...  [in template "20116#20152#31497" in macro "displayCategories" at line 34, column 49]
	- Reached through: @displayCategories categories=categories  [in template "20116#20152#31497" at line 12, column 33]
----
1<#if entries?has_content> 
2		<#list entries as entry> 
3			 
4				<!--<div class="results-header"> 
5					<h3> 
6						${entry.getName()} 
7					</h3> 
8				</div>--> 
9 
10				<#assign categories = entry.getCategories()> 
11 
12				<@displayCategories categories=categories /> 
13			 
14		</#list> 
15 
16</#if> 
17 
18<#macro displayCategories 
19	categories 
20
21	<#if categories?has_content> 
22	 <select name="sgCategories" id="sgCategories" onchange="getSelected(this)"> 
23	    <option value="">--select--</option> 
24		<#list categories as category> 
25		    <#assign categoryURL = renderResponse.createRenderURL()> 
26		    ${categoryURL.setParameter("resetCur", "true")} 
27					${categoryURL.setParameter("categoryId", category.getCategoryId()?string)} 
28				<option value="${categoryURL}"> 
29					<!--<a href="${categoryURL}">--> 
30					${category.getName()} 
31					<!--</a>--> 
32 
33					<#if serviceLocator??> 
34						<#assign assetCategoryService = serviceLocator.findService("com.liferay.portlet.asset.service.AssetCategoryService")> 
35 
36						<#assign childCategories = assetCategoryService.getChildCategories(category.getCategoryId())> 
37 
38						<@displayCategories categories=childCategories /> 
39					</#if> 
40				</option> 
41			</#list> 
42		</select> 
43	</#if> 
44</#macro> 
45<script> 
46function getSelected(selectObject) { 
47    var value = selectObject.value;  
48    document.location.href = value; 
49
50</script>