Help

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Your xhtml file might not reference the bean. Look at the following java bean

@Name("adminPage")
@Scope(ScopeType.CONVERSATION)
public class AdminPageAction {

    @In
    private EntityManager em;

    @In
    @Out(required = false)
    private BlogEntry entry;

    @Create
    @Begin(join = true)
    public void create() {
         entry = new BlogEntry();
    }

    public void save() {
        em.persist(entry);
    }

}

The entry will be nicely outjected to be used in a xhtml page.

However, if the xhtml itself looks like this:

<h:form>
   <h:panelGrid columns="2">
      <h:outputText value="Subject" />
      <h:inputText value="#{entry.subject}" />
      <h:outputText value="Text" />
      <h:inputTextarea value="#{entry.text}" />
   </h:panelGrid>

   <h:commandButton action="#{adminPage.save}" value="Save" />
   <a:commandButton value="View" reRender="textPanel" />
</h:form>

<h:panelGrid columns="1" id="textPanel">
   <s:formattedText value="#{entry.text}" />
</h:panelGrid>

The adminPage won't be created until save/view is called, and at this point, entry will be null. You can get around this problem by referencing entry as #{adminPage.entry.} (don't forget to add getter/setter), by using a factory or by calling some dummy method in the bean from pages.xml.