1 Reply Latest reply on Oct 30, 2013 4:17 AM by Piotr Chowaniec

    seam 2.3 jstl tags without long running conversation

    Piotr Chowaniec Newbie

      Hi all,


      I'm doing migration from seam 2.2 (jsf 1.2, jboss6) to seam 2.3 (jsf 2, jboss 7) and found strange behavior. I was able to reproduce it with contact-list example:

      edit viewContact.xhtml page and replace this fragment:

          <h:outputText id="Comments" value="Comments" rendered="#{not empty contact.comments}" />
          <h:outputText id="noComments" value="No Comments" rendered="#{empty contact.comments}" />

      with something like this:

      <c:if test="#{not empty contact.comments}">
        <h3><h:outputText value="Comments" /></h3>
      <c:if test="#{empty contact.comments}">
        <h3><h:outputText value="No Comments" /></h3>

      (don't forget to add namespace xmlns:c="http://java.sun.com/jsp/jstl/core")

      I known that change has no sense - it only demonstrates my problem.


      After rebuild/redeploy when you go to viewContact page and try to add any new comment you will get:

      Exception during request processing:

      Caused by javax.servlet.ServletException with message: "java.lang.IllegalStateException: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jboss.seam.example.contactlist.Comment.contact -> org.jboss.seam.example.contactlist.Contact"

      Now let's do some other changes to begin long running conversation after entering viewContact page (and end it after persisting comment)

      In pages.xml insert this fragment:

      <page view-id="/viewContact.xhtml">
              <begin-conversation />
              <param name="contactId" value="#{contactHome.id}" converterId="javax.faces.Long" />
                  <rule if-outcome="persisted">
                      <end-conversation />
                      <redirect />
                  <rule if-outcome="removed">
                      <redirect view-id="/search.xhtml" />

      In viewContact.xhtml change submit button:

      <h:commandLink id="submit" action="#{commentHome.persist}" 
        value="Create Comment" >

      Now, after redeploy, new comment can be added - no exception is thrown.


      Can someone explain to me why using jstl tags without long running conversation is not working with seam 2.3?




      I askes same question on stackoverflow (http://stackoverflow.com/questions/15361513/using-jstl-tags-in-seam-2-3-without-long-running-conversation-is-not-working) and got answer:

      "JSTL runs during view build time, not during view render time. Related: stackoverflow.com/questions/3342984/… – BalusC" but have no idea how it can be related to long running conversations.