ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Robinson <jus...@venturenet.co.za>
Subject Re: FreeMarker requestAttribute issue
Date Wed, 04 May 2011 14:55:51 GMT
Brilliant thanks...for saving me some time... been reading the freemarker
manual & looking at the the ofbiz freemarker framework all afternoon.
*That code was on OrderEvents but I moved it to a groovy script, were all
the parameters gotten from the request seem to be available anyway.*

On Wed, May 4, 2011 at 2:49 PM, Scott Gray <scott.gray@hotwaxmedia.com>
wrote:
> You need to put it in the screen context and not in the request
attributes, if you're using groovy then it's just:
> context.surveyWrapper = surveyWrapper
>
> Reason being that the request attributes (and session attributes and
parameters) have already been placed in the context at the start of the
screen rendering and your actions are occurring after that point.
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 4/05/2011, at 9:55 PM, Justin Robinson wrote:
>
>> surveyWrapper?has_content always returns false no matter that the
>> debug shows that it's not null when it's set.
>> Have tried setting it as a session attribute, with no effect.
>> Am really stumped on this one no idea what to try....Any ideas?
>>
>>
>> the ftl:
>> <div class="screenlet">
>>    <div class="screenlet-body">
>>        <#-- Render the survey -->
>>        <#if surveyWrapper?has_content>
>>            <form method="post" enctype="multipart/form-data"
>> action="<@ofbizUrl>profilesurvey/profilesurvey</@ofbizUrl>"
>> style="margin: 0;">
>>              ${surveyWrapper.render()}
>>            </form>
>>        <#else>
>>            <h1>Survey Failed</h1>
>>            <p>surveyWrapper?has_content returned false</p>
>>        </#if>
>>    </div>
>> </div>
>>
>> code that sets the surveyWrapper:
>> // set up a surveyAction and surveyWrapper, then redirect to survey
>> ProductStoreSurveyWrapper wrapper = new
>> ProductStoreSurveyWrapper(surveys.get(0), cart.getOrderPartyId(),
>> UtilHttp.getParameterMap(request));
>> Debug.log("wrapper: "+(wrapper!=null? "not null":"null"), MODULE);
>> request.setAttribute("surveyWrapper", wrapper);
>> request.getSession().setAttribute("surveyWrapper", wrapper);
>> request.setAttribute("surveyAction", "addOrderItemSurvey")
>>
>> Regards,
>> Justin
>> Venture-Net Research & Development
>
>



-- 
Regards,
Justin
Venture-Net Research & Development

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message