
In this part of the tutorial we will correct the bugs inherent in version 2.2 of Seam-gen and we will add some code to spice up our blog CMS.
First of all, our PostEdit.seam page is not working at all as it is. We shall fix this:

Figure 4.1 - Fixing the PostEdit.xhtml page
Open PostEdit.xhtml from the WebContent folder and find the <rich:tabPanel switchType=”ajax”> block. This is what’s causing the problem, because it has more than one tab – one to have the user select a category from a grid on another page, and the second one for selecting a user, since these two entites have @ManyToOne relationships to the post entity, and Seam-gen can’t handle generating more than one joined object selection user interface item in this version.
I don’t want an external grid for selection of a category anyway, so we will delete the entire <rich:tabPanel> block on this page, and instead make the category selectable from a pop-up menu using a typical JSF selectOneMenu UI component.
After you delete the <rich:tabPanel> go towards the beginning of the page and locate the code block starting with <s:decorate id=”titleField” template=”layout/edit.xhtml”>.
Within that block replace <h:inputTextarea id=”title” cols=”80″ rows=”2″ required=”true” value=”#{postHome.instance.title}”/> with <h:inputText id=”title” required=”true” value=”#{postHome.instance.title}”/>
Next, add the following code block below the closing tag (</s:decorate>) for titleField:
<s:decorate id="categoryField" template="layout/edit.xhtml">
<ui:define name="label">Post Category</ui:define>
<h:selectOneMenu id="category"
required="true"
value="#{postHome.instance.title}">
<s:selectItems value="#{categoryList.resultList}" var="cat" label="#{cat.name}" noSelectionLabel="Please select..." />
<s:convertEntity />
</h:selectOneMenu>
</s:decorate>
Continue reading →