2 Replies Latest reply on Sep 23, 2008 5:52 PM by luxspes

    ScopeType.PAGE: Lost by AJAX?

      Hi!


      If I store something in ScopeType.PAGE, and the I try to use it with a4j, it gets lost!


      Is this the expected behavior? (Do I need to use CONVERSATION even if I am in the same page?)


      Regards,

        • 1. Re: ScopeType.PAGE: Lost by AJAX?
          bernix.bernix.ning.gmail.com

          Our project uses lots of POJO Seam components with PAGE scope, and we can use the ajax(richfaces ajax4j), works fine.


          Could you provide you code(backing bean, xhtml)?

          • 2. Re: ScopeType.PAGE: Lost by AJAX?

            Thanks, but, it was my mistake, I am using SpringJdbc for this project (its a legacy database with stored procedures and other crazy stuff so integration with JPA/Hibernate was not an option):


            Map<String, Object> subactivity= jdbcTemplate.queryForMap(...
            



            it turns out that the map returned is a ListOrderedMap.decorate(new CaseInsensitiveMap()); and therefore its key/values can be linked to JSF like this:


            #{activityEditor.subactivity['description']}
            



            or like this (I was using the former)


            #{activityEditor.subactivity['DESCRIPTION']}
            



            But I didnt know that, so, when I asked for a rerender after calling an action with a commmandLink, I was returning a plain old HashMap:


            Map<String, Object> transfomedSubactivity = new HashMap<String, Object>();
            transfomedSubactivity.putAll(subactivity)
            return transfomedSubactivity;
            



            and that changed all the keys to uppercase, therefore this didn't work anymore:


            #{activityEditor.subactivity['description']}
            



            and I wrongly believed it was because of ScopeType.PAGE, but it was because HashMap is case sensitive.


            Regards,