3 Replies Latest reply on Jul 26, 2006 3:50 PM by gavin.king

    s:link does not work after JBoss restart

      On a results screen I use the s:link tag in a table. The results screen is generated from a SFSB with ScopeType.EVENT. When the user clicks on the <s:link /> action, a new screen opens up from another SFSB with ScopeType.CONVERSATION.

      This works great until JBoss is restarted. Once restarted, the view action (below) on an existing results screen returns the results.xhtml screen without any records and does not seem to call the SFSB editor.view that I expected.

      Should this work? Or I'm trying to do something not allowed?

      Link in results.xhtml

      <h:dataTable value="#{fulfillments}" var="fulfillment">
       <h:column>
       <f:facet name="header">Action</f:facet>
       <s:link value="View" action="#{editor.view}" propagation="none">
       <f:param name="id" value="#{fulfillment.orderID}"/>
       </s:link>
       </h:column>
      </h:datatable>
      


      Finder.java
      @Name("finder")
      @Stateful
      @Scope(ScopeType.EVENT)
      @LoggedIn
      public class Finder implements IFinder {
      
       @DataModel
       private List<Fulfillment> fulfillments;
      
       @DataModelSelection
       private Fulfillment selected;
      
       private Fulfillment fulfillment = new Fulfillment();
      
       @Begin(flushMode=FlushModeType.MANUAL)
       public String find(){
       fulfillments = DAFulfillment.find(fulfillment);
       return "found";
       }
      
       @Destroy
       @Remove
       public void destroy(){
       }
      
       public Fulfillment getFulfillment(){
       return fulfillment;
       }
      
       public void setFulfillment(Fulfillment fulfillment){
       this.fulfillment = fulfillment;
       }
      }
      


      Editor.java
      @Name("editor")
      @Stateful
      @LoggedIn
      public class Editor extends AbstractEditor implements IEditor{
      
       public Fulfillment fulfill;
      
       @RequestParameter
       protected Long id;
      
       @DataModel
       private List<Item> items;
      
       @DataModelSelection
       private Item item;
      
       @Create
       @Begin
       public void initialize(){
       fulfill = load(Fulfillment.class, id); //does loading in a superclass
       items = new ArrayList<Item>();
       items.addAll(fulfill.getItems());
       }
      
       public String save(){
       persist(fulfill);
       return super.save(); //super method returns "saved";
       }
      
       @End
       public String cancel(){
       em.refresh(fulfill);
       return "cancel";
       }
      
       @End
       public String return(){
       em.refresh(fulfill);
       return "return";
       }
      
       @Destroy
       @Remove
       public void destroy(){
       }
      
       public Fulfillment getFulfill(){
       return fulfill;
       }
      
       public void setFulfill(Fulfillment fulfill){
       this.fulfill = fulfill;
       }
      }
      



      Thanks,
      Chris....

        • 1. Re: s:link does not work after JBoss restart
          gavin.king

          Ah. Hmmmm. I think I know what the problem is.

          Seam can't just let you call any arbitrary method by hacking action=name.method into the URL of a GET request. So it only lets you call action methods that were previously rendered via an s:link. Of course, once you restart the server, it "forgets" ;-)

          I'll see if something more can be done here if you can add an issue to JIRA.

          Otherwise use a page action defined in pages.xml if you need truly bookmarkable links.

          • 2. Re: s:link does not work after JBoss restart

            opened JIRA: http://jira.jboss.org/jira/browse/JBSEAM-319

            I'll take a look at the page actions again to see if I can figure out how to use those. I don't so much need bookmarkable links, as I want to make the results screen reslient to server system crashes.

            This led me to another question: in a clustered environment, is the <s:link> history replicated? I don't use a cluster in my environment yet; but we are moving that way....

            Chris....

            • 3. Re: s:link does not work after JBoss restart
              gavin.king

              It goes in the application scope so no, it is not replicated.

              Two possible solutions:

              (1) stick stuff in jboss cache (that way it gets replicated)
              (2) require that all these actions be declared, so we can init the list of allowed actions at startup

              Neither of these options is great.