Fórumok
Set variable not working
andres digiovanni, módosítva 11 év-val korábban
Set variable not working
New Member Bejegyzések: 14 Csatlakozás dátuma: 2012.09.18. Legújabb bejegyzések
Hi,
I'm trying to set a variable with the value of a method. But it doesn't work. I get this error:
java.lang.NullPointerException
But if I use this code, it print the correct value:
Why I can't set a variable with the value?
I'm using a template web content.
Regards,
Andrés
I'm trying to set a variable with the value of a method. But it doesn't work. I get this error:
java.lang.NullPointerException
#set ($assetLinkLocalService = $serviceLocator.findService("com.liferay.portlet.asset.service.AssetLinkLocalService"))
#set ($assetlinks = $assetLinkLocalService.getDirectLinks( $ae.getEntryId() ))
#set ($siz = $assetlinks.size())
But if I use this code, it print the correct value:
#set ($assetLinkLocalService = $serviceLocator.findService("com.liferay.portlet.asset.service.AssetLinkLocalService"))
#set ($assetlinks = $assetLinkLocalService.getDirectLinks( $ae.getEntryId() ))
$assetlinks.size()
Why I can't set a variable with the value?
I'm using a template web content.
Regards,
Andrés