2 Replies Latest reply on Jun 8, 2006 10:44 AM by gavin.king

    @RequestParameter does not work (for me)

      Hello!

      I'm trying to use Seam's @RequestParameter-Feature it doesn't seem to work.

      I have the following EJB (shortened):

      @Stateless
      @Name("test")
      @Scope(ScopeType.STATELESS)
      public class TestBean implements Test {
      
       @RequestParameter
       private String parameter;
      
       public String getParameter() {
      
       return parameter;
       }
      }



      The JSF-Page has:

      <h:outputText value="#{test.parameter}"/>
      


      So if I call the jsf-page with ?parameter=Hello I would expect the page to show "Hello". However, this does not work. The parameter is always null.


      Am I missing something?

      Regards

      Felix Hoßfeld

      P.S.: My Setup is JBoss 4.0.4GA EJB3 with Seam 1.0 CR3.


        • 1. Re: @RequestParameter does not work (for me)

          Replying to myself:

          Stupid me. I forgot to declare the Interceptor in ejb-jar.xml.

          I think this may be a common mistake. I think it would be helpful to add a comment in the sources of the examples to make it more obvious that an interceptor has to be declared on EJBs. (Or use the @Interceptor-Annotation).

          BTW: What about "short-term" injection on a stateless session bean?
          The documentation mentions:

          In all dependency injection implementations that
          we have seen, injection occurs when the component is constructed, and the reference does not subsequently
          change for the lifetime of the component instance. For stateless components, this is reasonable. From the point
          of view of a client, all instances of a particular stateless component are interchangeable.


          This sounds a bit like injecting into a stateless session bean is an uncommon design pattern. I find it rather to have tie jsf components to a temporary seam component to hold the values and then inject this into a stateless action bean. It works while testing as a single user.

          Is this likely to cause problems in a multi user enviroment?

          Regards

          Felix

          • 2. Re: @RequestParameter does not work (for me)
            gavin.king

             

            This sounds a bit like injecting into a stateless session bean is an uncommon design pattern.


            No, that is perfectly normal.