Archive

Archive for the ‘Web development’ Category

JSF2: Finding and re-rendering deeply nested components in different NamingContainers

July 5th, 2011 No comments

In complex JSF web applications, you sometimes need to re-render (i.e. update via AJAX) a component located outside of the current form (note that forms should not be nested). While you can access a composite’s parent in EL using the #{cc.parent} attribute, this is not of much help if your component is deeply nested in a different sub-tree of the component hierarchy. Read more…

JSF2: Rendering facets inside nested composite components

January 27th, 2011 1 comment

…is not supported, as I just found out:

<composite:interface>
	<composite:facet name="basketContent"/>
</composite:interface>

<composite:implementation>		 
	<mycomponents:box title="Shopping basket">
		<composite:renderFacet name="basketContent"/>
	</mycomponents:box>
</composite:implementation>

Read more…

JSF2: Nesting forms into each other — not a good idea

January 23rd, 2011 No comments

This problem just cost me an hour worth of debugging: Clicking on a PrimeFaces <p:commandButton/> that was inside a composite component wouldn’t trigger the server-side action that was specified in the tag. Even more strange was that I had several of these buttons (created in a loop using <ui:repeat/>), and in the generated HTML, the first one wasn’t nested into an HTML form element, while the others were. Read more…

Spring @Transactional: Verifying transaction support / Local method calls

January 23rd, 2011 2 comments

A few days ago, I was debugging a persistence issue in a recently started project that uses Spring ORM + JPA 2.0/Hibernate for persistence. Using Spring’s declarative transaction support, enabling transaction management for your services is just a matter of annotating the service methods with @Transactional, assuming you have properly set up a transaction manager and tell Spring to process your @Transactional bean annotations:

<tx:annotation-driven proxy-target-class="true"/>

Since I couldn’t explain why my code wasn’t working, I began wondering if the transaction support for my service method was configured correctly. Read more…