[jboss-user] [JBoss Seam] - <ui:define> and injection

schlafsack do-not-reply at jboss.com
Tue Jan 15 08:15:12 EST 2008


I've come up against a problem with using facelets templates and seam injection.

I have the following two classes:


  | @Name("query")
  | @Scope(value = ScopeType.PAGE)
  | public class Query
  | {
  |    ...
  | }
  | 


  | @Name("search")
  | @Scope(ScopeType.EVENT)
  | public class Search
  | {
  |    @In Query query;
  |    ...
  | }
  | 

I have a search widget (query.xhtml) that binds to the Query class:


  | <ui:composition>
  |    <h:form>
  |       <h:inputText value="#{query.expression}" />
  |       <h:commandButton value="Search" />
  |    </h:form>
  | </ui:composition>
  | 

and a results page that runs the query and displays the results:


  |    <ui:include src="query.xhtml" />
  |    <div>
  |       <h:outputText value="Results are #{search.results}" />
  |    </div>
  | 

Everything works fine until I use a ui:define tag to break up my page and use templates:


  | <ui:composition template="searchTemplate.xhtml">
  | 
  |    <ui:define name="query">
  |       <ui:include src="query.xhtml" />
  |    </ui:define>
  | 
  |    <ui:define name="results">
  |       <h:outputText value="Results are #{search.results}"/>
  |    </ui:define>
  | 
  | </ui:composition>
  | 

When an element that binds to query and an element that binds to search are in separate <ui:define>'s I get a RequiredException:

RequiredException: @In attribute requires non-null value: search.query

Is this expected behaviour or am I not understanding the lifecycle of the pages properly?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120063#4120063

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120063



More information about the jboss-user mailing list