How to get Server Name and Server Port from Liferay velocity template?
问题 In jsp page we can get Server Name and Server Port by using request.getServerName() and request.getServerPort().` As we can't get HttpServletRequest from Liferay velocity template, Is there any other way to get both Server Name and Server Port ? Please answer with a small code snippet.. 回答1: In your Liferay sources you can find com.liferay.portal.velocity.VelocityVariablesImpl . This class is placed under portal-impl/src/com/liferay/portal/velocity/VelocityVariablesImpl.java . If you check