moon.google.com “Extras” starts tonite. Ricky Gervais’ new TV show
Jul 20

Using namespaces to declutter JSF/Spring files

Tech Add comments

When you plug together a web framework, and Spring, you end up making choices on how to do this (unless you use Spring MVC).

Considering DRY, you really don’t want to have to:

a) Setup the model as a bean in Spring
b) Also setup the same bean (with the same name maybe for convention) in the web framework

Seeing all of this configuration can be irksome, so we thought that this would be a perfect use of namespaces which could allow us to go from:

<managed-bean>
<managed-bean-name>newWidget</managed-bean-name>
<managed-bean-class>de.mindmatters.faces.spring.SpringBeanScope</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>

<bean id=”newWidget” class=”model.Widget” singleton=”false”/>

To:

<bean id=”newWidget” class=”model.Widget” singleton=”false” jsf:scope=”request”/>

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: What are the first four letters in the word British?