Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Question about embedding flex portlets in WLP

Avatar

Level 1

I need to use a different wrapper jsp other then portlet-view.jsp The LiveCyle documents states I need to set the "view_jsp" attribute to my jsp that is located in the wsrp-jsp folder. I updated my portlet.xml file with the following code:

<init-param>
        <name>view_jsp</name>
        <value>/wsrp-jsp/test-view.jsp</value>
    </init-param>

The portlet cannot find the test-view.jsp. My wsrp-jsp folder is at the root of my web content. Is there something else that needs to be set?

thanks

Dan

WLP 103.2

ES 2.6.1

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi Dan,

Can you instead try putting the view_jsp as a portlet preference e.g.

        <portlet-preferences>

            <preference>

                <name>view_jsp</name>

                <value>/wsrp-jsp/portlet-view.jsp</value>      // This folder is relative to WebContent, in this case WebContent/wsrp-jsp/portlet-view.jsp

                <read-only>true</read-only>

        </portlet-preferences>

Let me know if this works for you.

Thanks,

Rohit

View solution in original post

8 Replies

Avatar

Correct answer by
Employee

Hi Dan,

Can you instead try putting the view_jsp as a portlet preference e.g.

        <portlet-preferences>

            <preference>

                <name>view_jsp</name>

                <value>/wsrp-jsp/portlet-view.jsp</value>      // This folder is relative to WebContent, in this case WebContent/wsrp-jsp/portlet-view.jsp

                <read-only>true</read-only>

        </portlet-preferences>

Let me know if this works for you.

Thanks,

Rohit

Avatar

Employee

Hi Dan,

Did the above suggestion work for you?

Rohit

Avatar

Level 1

I'll give it a try but I'd like to know why you're suggesting that approach. I found one example of setting the view_jsp and it's set as an init-param. Should it be a pereference instead?

thanks

Dan

Avatar

Level 1

Rohit,

     Thanks, setting view_jsp as a portlet pereference instead of an init-param worked. Can you tell me where you found this information? All the info I've found says to set the view_jsp as an init param.

Thanks again for your help

Dan

Avatar

Employee

Glad to hear that it worked for you!

The LCDS documentation has a typo in it. We will get the documentation fixed.

Rohit

Avatar

Level 1

I have one more question for you.

I'm trying to have my portlets javascript function make a call to the embedded flex apps callback method. I've tried a couple different ways but none seemed to work. How would I make a call to the Flex callback method from the wrapper's JavaScript?

<script language="JavaScript" type="text/javascript">

        AC_FL_RunContent(
                    "src", "<%= srcPath %>",
                    "id", "<%= (String)request.getAttribute("portlet_name") %>",
                    "name", "<%= (String)request.getAttribute("portlet_name") %>", 
                    "width", "<%= request.getAttribute("width") %>",
                    "height", "<%= request.getAttribute("height") %>",
                    "align", "middle",
                    "quality", "high",
                    "FlashVars", "PORTLET_WS=<%= request.getAttribute("window_state")%><%= wsrpEncodedChannel %>",
                    "allowScriptAccess","sameDomain",
                    "type", "application/x-shockwave-flash",
                    "pluginspage", "http://www.adobe.com/go/getflashplayer");         
</script>

Avatar

Employee

Hi Don,

You can call Flex methods from your enclosing wrapper by using the Flex ExternalInterface API. You do this by adding a public method in your application to a list of callable methods. In your application, you add a local Flex function to the list by using the addCallback() method of the ExternalInterface API. This method registers an ActionScript method as callable from the JavaScript or VBScript in the wrapper.

For more details, look a the Using Flex SDK guide. For Flex 4, here is the link:

http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7e92.html.

Have you tried this out?

Rohit

Avatar

Level 1

Below is what I've tried. Also, not sure if it matters that the Flex app is embedded in a WLP portlet.

In my mxml file I added: ExternalInterface.addCallback("setEntityId", setEntityId);

In my wrapper jsp I added:

<script language="JavaScript" type="text/javascript">

        AC_FL_RunContent(
                    "src", "<%= srcPath %>",
                    "id", "<%= (String)request.getAttribute("portlet_name") %>",
                    "name", "<%= (String)request.getAttribute("portlet_name") %>", 
                    "width", "<%= request.getAttribute("width") %>",
                    "height", "<%= request.getAttribute("height") %>",
                    "align", "middle",
                    "quality", "high",
                    "FlashVars", "PORTLET_WS=<%= request.getAttribute("window_state")%><%= wsrpEncodedChannel %>",
                    "allowScriptAccess","sameDomain",
                    "type", "application/x-shockwave-flash",
                    "pluginspage", "http://www.adobe.com/go/getflashplayer");         
</script>

function getFlexApp(appName) {
        //alert("getFlexApp");
       if (navigator.appName.indexOf("Microsoft") != -1) {
           return window[appName];
       } else {
           return document[appName];
       }
    }

getFlexApp('IncList').setEntityId('xxx');