如何编写一个以Liferay主题访问的Java类? [英] How to write a java class to be accessed in liferay theme?
问题描述
我有一个方案,其中有一个用JSP编写的Java类,并且该JSP本身使用了它的成员.
I have a Scenario where I have a java class written in JSP and its members are used in that JSP itself.
JSP是liferay portlet的一部分.
The JSP is part of a liferay portlet.
现在,我需要在liferay主题中为速度模板编写该类,以便可以在navigation.vm文件中访问它.
Now, I need to write that class for the velocity template in liferay theme so that I can access it in navigation.vm file.
以下是虚拟片段-
xyz.jsp(部分)
<body>
<%
final class DummyABC {
public String method1() {
}
public String method2() {
}
public String method3() {
}
}
%>
</body>
我需要在我的navigation.vm文件中访问此类.
I need to access this class in my navigation.vm file.
请帮助我解决这个问题.
Please help me through it.
推荐答案
您可以编写新的Java类并在init.vm文件中创建一个对象,以便Navigation.vm文件可以访问此变量
You can write new java class and create a object in init.vm file so that navigation.vm file can access this variable
这篇关于如何编写一个以Liferay主题访问的Java类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!