1 Reply Latest reply on Sep 4, 2009 12:56 PM by jamesjmp

    weird behaviour of @RequestParameter

      hi:
      I've found a strange behaviour of @RequestParameter.
      I´m facing a situation when @RequestParameter doesn´t get the same evalue as Redirect.instance().getParameters() does.
      This is the code:


      @Stateful
      @Name("nationalManager")
      @Scope(ScopeType.CONVERSATION)
      public class NationalClientManager extends OrderClientAbstractClass implements NationalClientManagerable {
      
          @RequestParameter("clientParam")
          private Integer clientParam;
      
      
          public void create() {
              System.out.println("clientParam "+clientParam);
              Object client = Redirect.instance().getParameters().get("clientParam");
              Integer cli = new Integer(-1);
              System.out.println("client-->"+client+"<--");
              if (client != null && !client.equals("")) {
                  cli = (Integer)client;
                  System.out.println("cli "+cli);
                  clientParam = cli;
              }
              else {
                  System.out.println("client es nulo");
              }
      



      And this is the output:



      12:25:03,468 INFO  [STDOUT] clientParam null
      12:25:03,468 INFO  [STDOUT] client-->1<--
      12:25:03,468 INFO  [STDOUT] cli 1
      



      Create is invoked twice.
      First time: because it´s in the action of a page.xml file.
      This time, both ways of accessing clientParam  get same value.
      Second time: after an ajax execution, this param is null for my clientParam but has a value for Redirect.instance().getParameters().
      Has it sense? I thought they should get same value for same parameter.
      thanks in advance!