Outjection Ignored...
clatimer Apr 24, 2008 3:31 AMI am having a problem getting objects to outject properly.
I have a stateless session bean as follows
@Stateless @Name("smaListAction") public class SmaListAction implements SmaListActionLocal { @In(create=true) DailySmaLevelDAO smaLevelDAO; @In(create=true) DailyProcessingStatusDAO dailyProcessingDAO; @Out(required=true, scope=ScopeType.EVENT) List<DailySmaLevel> smaLevels; @Out(required=true, scope=ScopeType.EVENT) Date asOfDate; public String viewSmaList() { asOfDate = dailyProcessingDAO.getCurrentAsOfDate(); System.out.println(asOfDate); smaLevels = smaLevelDAO.findDailySmaLevelsWithinRange(asOfDate); System.out.println("Retrieved: " +smaLevels.size()); return "success"; } }
I am then trying to use the outjected objects asOfDate and smaLevels in my ui component:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html 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"> <ui:composition template="/templates/layout.xhtml"> <ui:define name="left"> Stocks within 1/2 percent of their 50 day SMA for as of date #{asOfDate} <h:dataTable value="#{smaLevels}" var="smaLevel" > <h:column> <f:facet name="symbol"> <h:outputText value="Symbol" /> </f:facet> <h:outputText value="#{smaLevel.stockSummary.symbol}" /> </h:column> <h:column> <f:facet name="fiftyDaySma"> <h:outputText value="50 Day SMA" /> </f:facet> <h:outputText value="#{smaLevel.fiftyDaySma}" /> </h:column> <h:column> <f:facet name="hundredDaySma"> <h:outputText value="100 Day SMA" /> </f:facet> <h:outputText value="#{smaLevel.hundredDaySma}" /> </h:column> <h:column> <f:facet name="twoHundredDaySma"> <h:outputText value="200 Day SMA" /> </f:facet> <h:outputText value="#{smaLevel.twoHundredDaySma}" /> </h:column> </h:dataTable> </ui:define> </ui:composition> </html>
When I use my website to access the page, both the asOfDate and the smaLevels objects evaluate to null. I have tried using both ScopeType.EVENT and ScopeType.PAGE and both times it evaluates to null. However, when I annotate my action method viewSmaList with an @Begin(join=true) and set the scope of the outjected objects to ScopeType.CONVERSATION it gets put into the conversation scope as I expected. There is really no reason to have a conversation for this interaction though; it truly is stateless.
Can anyone help me understand why outjection is not working unless I use the conversational context? According to the examples in the Seam Documentation section 3.3 Bijection I should be able to outject to any valid ScopeType I specify, so I'm pretty much stumped.
Thanks in advance,
Chris Latimer