jMaki in portlets


The latest version of jMaki 1.0 beta (v.8.3.1) fixes a problem that was preventing jMaki widgets from working in portlets.  jMaki is a powerful, lightweight AJAX web application framework.  jMaki wraps other UI libraries providing an extensive library of widgets from Dojo, Flickr, Google, Mochikit, Scriptaculous, Spry, and Yahoo.  Now you can use all these widgets in your portlet applications.

I would highly recommend using the jMaki Netbeans plugin (1.6.9+), paired with the Portal Pack plugin.  You can watch Greg and Ludo's screencast.  And use the following different steps to get it working with your portlet application:
  1. Create a new portlet application project.
  2. Open project properties (right-click on project, Properties)
  3. Choose Frameworks, Add, jMaki Ajax Framework (CSS Layout does not apply here as the view.jsp for the portlet will not use it.)
  4. While in properties, check that the Run (under categories) lists Open Source Portlet Container as the server.
  5. Open Web Pages->WEB-INF->jsp->view.jsp
  6. Now you can drag-n-drop jMaki widgets and use the properties editor just like you saw in the screencast.
  7. Build, deploy, and test.  Repeat. (The portlet container will require the portlet application be redeployed, unlike web app in the screencast.)
There is one limitation.  jMaki widgets that use the XmlHttpProxy (service bundled with the framework) need to be specially configured to work within a portlet.  These widgets include flickr.search, google.mappopup, yahoo.geocoder, and any other custom widgets that use the XmlHttpProxy.   Due to a limitation in the portlet spec (JSR-168), the session-based restriction to the XmlHttpProxy fails.  This will present itself only by the Ajax request failing and the portlet showing no response.  (Firebug users will see the HTTP 403 error "Access to the specified resource () has been forbidden." in the Ajax response.)

In order to work around this, you will need to set the allowXDomain requireSession context parameter in the web.xml for the portlet application.
<context-param>
  <param-name>requireSession</param-name>
  <param-value>false</param-value>
</context-param>
However, it is important that you understand the security implications of allowing unrestricted access to these services.  This means that you are opening up the defined XmlHttpProxy services to any other applications that know the appropriate URL for your portlet application.  Please read Greg Murray's blog on Restricting Access to your Ajax Services.

The jMaki widgets may seem like so many bells and whistles (Sudoku portlet anyone :) ), but Patrice Goutin shows how to use the Dojo table widget for easily creating the UI for a SAP name search portlet.

Update (20070508): Notice the change to the requireSession context parameter.  This is effective from jMaki 0.9.2 (bundled with Netbeans module 1.6.9.6)
Comments:

At the jMaki netbeans plugin page, the only version available is 1.6.8. Even at the download page, the 1.6.8 is the only version available. Do you known if 1.6.8 will work with portlets ?

Posted by Claudio Miranda on February 22, 2007 at 07:48 PM MST #

Hi Claudio - Please download the Ajax Update Center module and use the Update Center in Netbeans to download the latest jMaki plugin (1.6.9). Thanks. GregZ https://ajax.dev.java.net/files/documents/3115/45044/org-netbeans-modules-sun-ajax-updatecenter.nbm

Posted by GregZ on February 23, 2007 at 12:21 AM MST #

I apologize for the mistake. Version 1.6.9 of the Netbeans plugin for jMaki (required for portlet support) is not available yet through the Update Center. Please find the download here: https://ajax.dev.java.net/servlets/ProjectDocumentList?folderID=6844 Read more about portlet support in jMaki version .8.3.1 here: https://ajax.dev.java.net/servlets/ReadMsg?listName=dev&msgNo=370

Posted by GregZ on March 12, 2007 at 05:15 AM MDT #

Am I correct that jMaki supports portlets only in the "vanilla" JSP mode and not using JSF? I tried jMaki JSF with portlets but got Exceptions, for example a ClassCastException where jMaki & JSF was expecting a ServletContext but got a PortletContext.

Posted by Richard Cook on March 26, 2007 at 05:35 AM MDT #

Yes. That is true. I have not tested jMaki with JSF in portlets. In particular, I know that any portlet that uses JSF must also bundle the JSF-Portlet bridge (see https://jsfportletbridge.dev.java.net/) Sorry! I haven't explored how this would all work together.

Posted by GregZ on March 30, 2007 at 08:53 AM MDT #

Check out this www.ajaxdiff.com site which is a new community platform for comparing AJAX frameworks. It is completely open for community contributions allowing adding and updating framework details and indexing related publications. The platform was aired today with initial content and is waiting for you guys to start pumping information to it. I will be happy to receive feedbacks. The site is built upon a dedicated framework that will be updated with your ideas. Thanks, Joe Abrams

Posted by Joe Abramsy on April 05, 2007 at 07:44 AM MDT #

I have tried the JSF + JSR-168 (portlet) + jMaki combination and after several late nights with lot's of trouble I finally made it:) The difficult thing for me was that I didn't understand initally that JBoss bundled with a JSF implementation (MyFaces) in JBoss version prior to 4.2.0GA. This made it difficult to deploy "JSF portlets" to JBoss. In JBoss 4.2.0 GA the sun's JSF 1.2 RI is bundled and it got easier to deploy. (don't bundle a JSF implementation with your portlet!) I used Netbeans 6.0M9 to create a portlet project, and when using it in combination with JSF, I had to delete the java class that extended the GenericPortlet, and rather create a new class (that didn't extend/implement anything). The new class became my backing bean (ref JSF) where I implemented all my actions that I referenced from my JSF page. I have tried several jMaki widgets in my portlet with problems, but I still have a couple of issues left which I have posted on the forum: 1. http://forums.java.net/jive/thread.jspa?threadID=28321&tstart=0 2. http://forums.java.net/jive/thread.jspa?threadID=27671&tstart=0

Posted by Viggo Navarsete on July 09, 2007 at 02:27 AM MDT #

A note to my previous comment: I had to bundle a JSF portlet bridge in order to use JSF. See https://jsfportletbridge.dev.java.net/ and this description for configuration of web.xml and portlet.xml: https://jsfportletbridge.dev.java.net/DeployingJSFPortlet.html

Posted by Viggo Navarsete on July 10, 2007 at 01:32 AM MDT #

Thanks a bunch Viggo for the update on using JSF and jMaki in portlets. Honestly, I do not use JSF, but is great to know it works. Good luck getting your jMaki issues worked out!

Posted by GregZ on July 10, 2007 at 05:54 AM MDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

gregz

Search

Top Tags
Categories
Archives
« July 2015
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
       
Today