OFBiz
  1. OFBiz
  2. OFBIZ-4669

sessionAttributes doesn't work from screen widget

    Details

      Description

      In the screen widget, add a set action that refers to sessionAttributes, it doesn't work.

      e.g: Following doesn't work:
      <set field="titleProperty" value="$

      {sessionAttributes.autoName}

      "/>

      Following works:
      <set field="titleProperty" from-field="autoName" from-scope="user"/>

        Activity

        Hide
        Erwan de FERRIERES added a comment -

        Hi Kira,

        what do you want to say with this issue ?

        Regards,

        Show
        Erwan de FERRIERES added a comment - Hi Kira, what do you want to say with this issue ? Regards,
        Hide
        Kiran Gawde added a comment -

        Hello Erwan,

        Seems like sessionAttributes doesn't work in screen widget. But I see
        reference to it in few other places:

        e.g: In ProfileScreens.xml
        <set field="previousParams" from-field=
        "sessionAttributes.PREVIOUS_PARAMS"/>

        So, I either we get sessionAttributes working or replace the references.

        Regards,
        Kiran Gawde

        Show
        Kiran Gawde added a comment - Hello Erwan, Seems like sessionAttributes doesn't work in screen widget. But I see reference to it in few other places: e.g: In ProfileScreens.xml <set field="previousParams" from-field= "sessionAttributes. PREVIOUS_PARAMS "/> So, I either we get sessionAttributes working or replace the references. Regards, Kiran Gawde
        Hide
        Jacques Le Roux added a comment - - edited

        Erwan, Kiran,

        It seems, at least, the one used in Party component is useless (or I don't see its use). To be more clear I mean

        <form name="NewUser" type="single" target="${target}${previousParams}"
        
        Show
        Jacques Le Roux added a comment - - edited Erwan, Kiran, It seems, at least, the one used in Party component is useless (or I don't see its use). To be more clear I mean <form name= "NewUser" type= "single" target= "${target}${previousParams}"
        Hide
        Jacques Le Roux added a comment -

        BTW it seems that this is known for a moment, also for requestAttributes.

        <!-- TODO/NOTE DEJ20070223: for some reason this isn't working, doing an assign within the FTL file which does work: <set field="productCategoryLink" from-field="requestAttributes.productCategoryLink"/> -->

        They are both represented by a freemarker.ext.servlet.HttpSessionHashMode
        sessionAttributes = freemarker.ext.servlet.HttpSessionHashModel@4559a
        requestAttributes = freemarker.ext.servlet.HttpRequestHashModel@902aea

        Show
        Jacques Le Roux added a comment - BTW it seems that this is known for a moment, also for requestAttributes. <!-- TODO/NOTE DEJ20070223: for some reason this isn't working, doing an assign within the FTL file which does work: <set field="productCategoryLink" from-field="requestAttributes.productCategoryLink"/> --> They are both represented by a freemarker.ext.servlet.HttpSessionHashMode sessionAttributes = freemarker.ext.servlet.HttpSessionHashModel@4559a requestAttributes = freemarker.ext.servlet.HttpRequestHashModel@902aea
        Hide
        Daniel Riquelme added a comment -

        I guess it's because freemarker.ext.servlet.HttpSessionHashModel and freemarker.ext.servlet.HttpRequestHashModel are only intended to work in ftl.

        org.ofbiz.widget.screen.ScreenRenderer has the following:
        line: 240

        // these ones are FreeMarker specific and will only work in FTL templates, mainly here for backward compatibility
        BeansWrapper wrapper = BeansWrapper.getDefaultInstance();
        context.put("sessionAttributes", new HttpSessionHashModel(session, wrapper));
        context.put("requestAttributes", new HttpRequestHashModel(request, wrapper));

        Show
        Daniel Riquelme added a comment - I guess it's because freemarker.ext.servlet.HttpSessionHashModel and freemarker.ext.servlet.HttpRequestHashModel are only intended to work in ftl. org.ofbiz.widget.screen.ScreenRenderer has the following: line: 240 // these ones are FreeMarker specific and will only work in FTL templates, mainly here for backward compatibility BeansWrapper wrapper = BeansWrapper.getDefaultInstance(); context.put("sessionAttributes", new HttpSessionHashModel(session, wrapper)); context.put("requestAttributes", new HttpRequestHashModel(request, wrapper));
        Hide
        Jacques Le Roux added a comment -

        OK,let's keep it seimple, like Kiran suggested I propose to replace the instances

        Show
        Jacques Le Roux added a comment - OK,let's keep it seimple, like Kiran suggested I propose to replace the instances
        Hide
        Daniel Riquelme added a comment -

        Here is a patch that fixes all instances of sessionAttributes in Screens. The Screens affected are:

        applications/commonext/widget/ofbizsetup/ProfileScreens.xml

        applications/commonext/widget/ofbizsetup/SetupScreens.xml

        applications/party/widget/partymgr/PartyScreens.xml

        No occurrences of sessionAttributes where found in Forms

        Show
        Daniel Riquelme added a comment - Here is a patch that fixes all instances of sessionAttributes in Screens. The Screens affected are: applications/commonext/widget/ofbizsetup/ProfileScreens.xml applications/commonext/widget/ofbizsetup/SetupScreens.xml applications/party/widget/partymgr/PartyScreens.xml No occurrences of sessionAttributes where found in Forms
        Hide
        Jacques Le Roux added a comment -

        Thanks Kiran, Daniel,

        Daniel your patch is in
        trunk r1340821
        R12.04 r1340822
        R11.04 r1340823
        R10.04 r1340824

        Show
        Jacques Le Roux added a comment - Thanks Kiran, Daniel, Daniel your patch is in trunk r1340821 R12.04 r1340822 R11.04 r1340823 R10.04 r1340824

          People

          • Assignee:
            Jacques Le Roux
            Reporter:
            Kiran Gawde
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development