We all work in different environments, development, test (maybe integration) and production servers or, maybe a set of servers that run the same application with different configurations.
Maven helps us build our jar and war components for different environments configuring profiles.
We are going to see here how we can use Maven profiles to build and [...]
Archive for the ‘Java World’ Category
Maven profiles
jQuery enable-disable elements
Let’s summarise here how to disable, enable, check, assign values and get selected values from your html document.
1
2
3
4
5
<select name="client.idClient" id="idClient">
<option value="1">CLIENT 1</option>
<option value="2">CLIENT 2</option>
<option value="3">CLIENT 3</option>
</select>
You can disable an element by setting the disabled attribute to disabled:
1
jQuery("#idClient").attr("disabled","disabled");
And enable the element by removing the disabled attribute:
1
jQuery("#idClient").removeAttr("disabled");
If the element is an input:
1
<input type="checkbox" id="yes"/>
then you have to [...]
JavaScript Liferay.PortletURL
Liferay Portal has a JavaScript library that allows the creation of portletURLs inside your JavaScript code. Something like:
<input type="button" value="<liferay-ui:message key="cancel" />"
onclick="<portlet:namespace/>_back();"/>
<script type="text/javascript">
function <portlet:namespace/>_back() {
var backURL = Liferay.PortletURL.createRenderURL();
[...]
Liferay hook war
Liferay Hooks are plugins that let you customise some of the Portal functionality.
In this post we are creating a simple Liferay hook to change the value of a property in the portal.properties, override one of the Portal jsps and handling an event.
Maven useful links
Some Maven useful links:
Maven lifecycle:
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
Maven create web app
http://maven.apache.org/plugins/maven-archetype-plugin/examples/webapp.html
Maven plugins
http://maven.apache.org/plugins/
Work on progress… any suggestions?
Get month name from Calendar.MONTH field
Here’s a method to get the month name from the Calendar.MONTH field:
public String getMonthFromInt(int iMonth) {
String month = "invalid";
DateFormatSymbols dfs = new DateFormatSymbols();
String[] months = dfs.getMonths();
if (iMonth >= 0 && iMonth <= 11)
month = months[iMonth];
return month;
}
Displaytag library in your portlet
These are – roughly – the steps that you need to follow if you are planing to use the displaytag library in your portlet.

