@DataModel problem with JB 4.0.4GA & SEAM 1.0.0.CR3
mmarcom Jun 12, 2006 9:03 AMhello all,
i am experiencing hugep roblem sin exposing one of my Session bean varaibles as a DAtaModel to be displayed in the page..
Here's an excerpt of my Stateful Session Bean
@Stateful
@Local ( {EControlSession.class})
@Name("econtrol")
@Scope(ScopeType.SESSION)
public class EControlSessionBean
implements EControlSession, java.io.Serializable
{
private Expense expense = new Expense();
private Item item = new Item();
@PersistenceContext
EntityManager em;
@DataModel("expenses")
List<Expense> expenses;
......
According to docs, Seam will expose my List as a context varaible named
"expenses".
then i wrote a small page (on the example of Seam example)
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:c="http://java.sun.com/jstl/core"
template="template.xhtml">
<ui:define name="body">
<h2> QueryPage</h2>
<f:view>
<h:form id="entry">
<h:commandButton action="#{econtrol.searchExpenses}" value="QueryAll"
class="formButton" style="width: 166px;" />
<c:choose>
<c:when test="#{expenses==null}">
<p>
This is the Expense search screen. Use the search
box to the right to search for Expenses.
</p>
</c:when>
<c:when test="#{empty expenses}">
<p>
No expenses were found
</p>
</c:when>
<c:otherwise>
<table align="center">
<tr>
<td>
<h:dataTable id="table"
value="#{expenses}"
var="expense"
rowClasses="oddRow, evenRow"
headerClass="tableHeader">
<h:column>
<f:facet name="header">
<h:outputText value="Date"/>
</f:facet>
<h:outputText value="#{expense.date}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Site"/>
</f:facet>
<h:outputText value="#{expense.site}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Amount ()"/>
</f:facet>
<h:outputText value="#{expense.totalAmount}"/>
</h:column>
</h:dataTable>
</td>
</tr>
</table>
</c:otherwise>
</c:choose>
</h:form>
<h:messages/>
</f:view>
</ui:define>
</ui:composition>
i thought it should have worked, instead the code correspondign to
<c:when test="#{expenses==null}">
<p>
This is the Expense search screen. Use the search
box to the right to search for Expenses.
</p>
</c:when>
is executed.
when i look at jboss logs, here's what i find
2006-06-12 13:52:18,968 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: expenses 2006-06-12 13:52:18,968 DEBUG [org.jboss.seam.Component] seam component not found: expenses 2006-06-12 13:52:18,968 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] could not resolve name
but i thought that according to that @DataModel annotation i could have exposed my expenses List..
i havent written any getExpenses() method, looking at seam examples all beans that exposes a @DataModel dont' have any getteres/setters for that...
can anyone tell me hwat i am missing?
thanks and regards
marco