Dev - alter eventMessageList because there is existence of error messages (errorMessageList)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Dev - alter eventMessageList because there is existence of error messages (errorMessageList)

Alan Sin
Hi,

Nice to meet you guys, this is my first time to subscribe post here, I hope that I can receive some responses of your kindness :)

At the moment I am on an OFBiz B2B project, I have a question about handling request attribute such as errorMessageList and eventMessageList in a bsh.

Here I am calling a service from uri, and which encounters error and throws back to the widget, however there is content in both errorMessageList and evenMessageList displayed on the screen
below is my request and view mapping, widget setting, service...

  <#--  request map-->
    <request-map uri="modifyRegistrationApplication">
        <security https="true" auth="true"/>
        <event type="service" invoke="changeRegistrationApplicationStatus"/>
        <response name="success" type="view" value="findRegistrationApplication"/>
        <response name="error" type="view" value="findRegistrationApplication"/>
    </request-map>

  <#-- view map-->
    <view-map name="findRegistrationApplication" type="screen" page="component://party/widget/partymgr/CommonScreens.xml#findRegistrationApplication"/>

  <#-- widget -->
    <screen name="main-decorator">
        <section>
            <actions>
                <!-- base/top/specific map first, then more common map added for shared labels -->
                <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/>
            </actions>
            <widgets>
                <container style="centerarea">
                    <!-- render appheader -->
                    <platform-specific><html><html-template location="component://party/webapp/partymgr/includes/header.ftl"/></html></platform-specific>
                   
                    <container style="contentarea">
                        <container style="column-main">
                            <!-- render messages -->
                            <platform-specific><html><html-template location="component://common/webcommon/includes/messages.ftl"/></html></platform-specific>
                            <decorator-section-include name="body"/>
                        </container>
                    </container>
                </container>
               
                <!-- render footer -->
                <platform-specific><html><html-template location="component://arl/webapp/interface/includes/footer.ftl"/></html></platform-specific>
            </widgets>
        </section>
    </screen>


   <screen name="findRegistrationApplication">
        <section>
            <actions>
                <set field="title" value="Find Registration Application"/>
                <script location="component://party/webapp/partymgr/WEB-INF/actions/party/findRegistrationApplication.bsh"/>
                <set field="headerItem" value="findRegistrationApplication"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator">
                    <decorator-section name="body">
                        <platform-specific>
                            <html>
                                <html-template location="component://party/webapp/partymgr/party/findRegistrationApplication.ftl"/>                               
                            </html>
                        </platform-specific>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <#-- changeRegistrationApplicationStatus service -->
    <add-error>
         <fail-message message="Primary Email Address is not found with the application from Party ${returnedApplication.groupName}.&lt;br&gt;Please update it's... " />
     </add-error>
     <check-errors/>

My work around
The changeRegistrationApplicationStatus service has an ERROR message, so the request attribute of "errorMessageList" would contain that error message.

However, when displaying it on the widget screen, the error message and the evenMessageList message "The action was performed successfully." were both displayed together. (and it looks ambigous)

I tried to modify the component://party/webapp/partymgr/WEB-INF/actions/party/findRegistrationApplication.bsh with:

if( request.getAttribute("errorMessageList") != null )
{
    request.removeAttribute("eventMessageList");
}

However, it didn't help the situation. I suspect that the bsh is run after the component://common/webcommon/includes/messages.ftl is generated.

However, from my understanding, the bsh will be run before everything in the widget.

So I am just wondering instead of changing the content of
component://common/webcommon/includes/messages.ftl  , is there any other way to configure the request attribute in the bsh?


Many Thanks
Alan Sin

 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev