0 Replies Latest reply on Mar 27, 2009 8:32 PM by lucius yu

    parameters do not get read in @create method

    lucius yu Newbie

      Here's a section in  pages.xml



      <page view-id="/assetDetail.xhtml"  login-required="true">
              <param name="assetId" value="#{assetDetail.assetId}"/>
              <rewrite pattern="/asset/edit/{assetId}"/>
      </page>



       


      when url /asset/edit/123 is hit, my backing bean annotated with @create needs to get the id so it can load an entity, but the assetId doesn't get assigned if the method is annotated with @Create.


      to work around this, I rid of the @create annotation, and added an action to the page tag:


      <page view-id="/assetDetail.xhtml" action="#{assetDetail.init}" login-required="true">




      this solves the problem and the init method will be invoked when url is hit, and param is assigned correctly.  however, everytime I click on action button in the page, the init method gets called again and I don't want that.. to work around it I had to add a line in the beggining of the method:


      if(asset != null) return;




      there must be a better way to solve this problem where init is hit only when the conversation starts and not invoked again throught the requests in the same conversation