Friday, June 24, 2011

Setting attributes in JSF2's commandLinks

One of the recurrent problem with JSF is how can I pass argument from my xhtml facelet page to my backing bean. I've seen various possibilities, but the simplest is probably this one.

<h:commandlink value="click me">
<f:setpropertyactionlistener target="#{myBean.mySetterMethod}" value="myNewValue" />
</h:commandlink>

The example is of course minimalist.

Monday, June 20, 2011

Spring with external configuration

org.springframework.beans.factory.config.PropertyPlaceholderConfigurer is well known for configuring external properties.
What may be less known is how to define default values.

1. Setting the values on the PropertyPlaceholderConfigurer
 


file://${system.properties.pointing.to.config.dir}/config.xml





42





2. Setting the value on the bean
 


file://${system.properties.pointing.to.config.dir}/config.xml