سؤال

i've our Liferay web content templates (.vm) in a IntelliJ-12 project and want to make the VelocityVariables accessable in the Editor, so some code like this:

#set ($portalURL = $getterUtil.getString($request.attributes.CURRENT_COMPLETE_URL))

knows about $getterUtil, $request and it's methods from all those VelocityVariables

Is this possible in any way?

هل كانت مفيدة؟

المحلول

You can define Velocity variables in comments, e.g.

#* @vtlvariable name="getterUtil" type="GetterUtil" *#

You can also do this in a special file so that your source code is not polluted with such comments.

To make IDEA aid you in this, put your caret on a usage of a variable in a Velocity template and press Alt+Enter to invoke quick-fix list. Then select "Define variable in comment" action.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top