I\'m using Adobe CQ5. I have made two components that are independent of each other. However, I want to use data from one component in the other one. How do I achieve this?
While there is nothing wrong with @kmb's answer, I almost always prefer to use higher level Apis than lower level ones. In the case of CQ, this means using the sling resource API instead of the JCR node API.
That would look something like this, assuming the same structure of the 2 components on a single page as he laid out.
Resource r = resourceResolver.getResource(currentResource, "../component2");
if(r != null) {
ValueMap props = r.adaptTo(ValueMap.class);
String somePropertyValue = props.get("someProperty", "");
}