New Visual JSF Portlet Builder in Portal Pack Beta 3

Posted: March 17, 2008 in NetBeans

http://blogs.sun.com/satya/resource/jsf-small.PNG         A new plug-in called "Visual Portlet Builder" has been added to the recently released Portal Pack Beta 3 plug-ins list. Sometime back I had written a blog entry on how to create a JSF based portlet using NetBeans 6 + Portal Pack through some manual steps. This new plug-in eliminates all those manual steps and provides JSF portlet building capability inside Netbeans. It uses the existing VisualWeb’s WYSWYG editor and enables portlet developers to design their JSF portlet through drag & drop components. You can use OpenPortal Portlet Container 2.0 RC1 to test your jsf based portlets.

Steps to create a JSF Portlet :

  • Create a Web Application with "Portlet Support" framework.
  • Right click on the project node, select New > Visual Web JSF Portlet Page
  • Enter page detail and press Finish.
  • Now you can drag & drop jsf components and design your jsf portlet page.
  • You can create more than one jsf portlet pages in the project and set them as VIEW/EDIT/HELP mode page for the jsf portlet.

To select jsf portlet pages for different modes of the portlet

  • Right click on the visual web jsf portlet page.
  • Select "Set as Initial" and select VIEW/EDIT/HEP mode page

Now you can build and deploy your project on OpenPortal Portlet Container from your NetBeans IDE.

The Portal Pack Beta 3 plug-ins are now available on both Portal Pack project site and NetBeans Beta Auto Update Center.

Advertisements
Comments
  1. bjorn says:

    hey,
    thx for this guide. I tried it out like it says,but when i deploy my portlet,i get the portlet window but in the inside ,nothing is displayed ,no components or whatsoever.
    any idea ?
    <jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core&quot; xmlns:h="http://java.sun.com/jsf/html&quot; xmlns:jsp="http://java.sun.com/JSP/Page&quot;
    xmlns:p="http://java.sun.com/jsf/portlet/components&quot; xmlns:webuijsf="http://www.sun.com/webui/webuijsf"&gt;
    <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
    <f:view>
    <p:portletPage>
    <div style="-rave-layout: grid; position: relative; height: 400px; width: 400px;">
    <webuijsf:themeLinks binding="#{PortletPage1.themeLinks1}" id="themeLinks1"/>
    <webuijsf:form binding="#{PortletPage1.form1}" id="form1">
    <webuijsf:button binding="#{PortletPage1.button1}" id="button1" style="position: absolute; left: 72px; top: 168px" text="Button"/>
    </webuijsf:form>
    </div>
    </p:portletPage>
    </f:view>
    </jsp:root>
    this is the jsf file(does this fall under html syntax ? :s)

  2. satya says:

    Which version of OpenPortal Portlet Container are you using? You should use OpenPortal Portlet Container RC1 to test your application. Anyway I will try your jsf file and let you know.

  3. Christian says:

    Satya,
    I see the same behaviour as Björn. The portlet container used is 2.0 RC 1.

  4. satyaranjan says:

    Christian,
    There was an issue related to context-root in Portet Container 2.0 RC1 due to which PC is not able to resolve resources like js though this works with PC 2.0 Beta . This issue has already been fixed and will be available in the next version of Portlet container. The workaround for PC 2.0 RC1 is, add a <display-name> in your application’s web.xml same as application name. Otherwise you can use PC 2.0 Beta 2 for jsf portlet.

  5. satya says:

    It’s a bug introduced in NB 6.0.1 woodstock runtime.
    You can set webuiAll="true" parseOnLoad="false" attribute of <webui:themeLinks> manually in your jsf page to make it work.
    <webuijsf:themeLinks id="themeId" webuiAll="true" parseOnLoad="false"/>
    FYI, here’s the bug filed for this issue
    https://woodstock.dev.java.net/issues/show_bug.cgi?id=1168

  6. Wolfgang says:

    Hey,
    same problems here, i can deploy the portlet but get an empty portlet at the portlet-container.
    I use NB 6.1 (final) and portlet-container 2.0 rc 2.
    thanks for help!

  7. satyaranjan says:

    Are you using multiple jsf portlet on the same page ? There was an issue with Portal Pack 2.0 Beta version/woodstock component.
    http://www.netbeans.org/issues/show_bug.cgi?id=132409
    This issue is fixed in the latest Portal Pack 2.0 Final version. It works on NetBeans 6.1 and Portlet Container 2.0 RC2 & Final.

  8. Wolfgang says:

    Hey,
    i just try to create an "Hello, World!" Portlet.
    Im using the latest version of Portal Pack + NB + OpenPortal Portlet Server + GlassFish V2.
    Everything seems to be fine, i dont get any errors while deploying, but the "Hello, World!" is not showing up. (Only the head of the portlet, with the default buttons)
    I try to post some more infos soon!
    Thanks for help!

  9. Paedagogus says:

    It works pretty seamlessly. Here are my basic steps:
    1.) Install the NetBeans 6.1 / GlassFish bundle.
    2.) Run the GlassFish Updater (right click the server in NetBeans).
    3.) Install portlet support (OpenPortal).
    4.) Run the NetBeans plug-in updater.
    5.) Click the "Refresh" button to refresh the catalog.
    6.) Choose all the Portal components and install them.
    7.) Right click the server node in the services tab, and chose "Add Server". Select OpenPortal, and point it to the same location as GlassFish. Start GlassFish (NOT the portal server — there seems to be a bug, at least on my machine).
    8.) Create a new web application and enable portlet support. Choose the OpenPortal
    9.) Right click the application project and choose "New…", then Visual Web JSF Portlet Page. It will be assigned to the "View" by default.
    10.) Drop a static text component on the page.
    11.) Run the application.
    It should show up with the static text in the window. Now you can go back and change the portlet page to actually do something.

  10. Pierre says:

    "Visual Web JSF Portlet Page"
    and "drag & drop components …"
    perfect
    but when I drag a Table on it, and in a next step a database-table to the Table header, I get
    "Target server does not support automatic Data Source creation" …
    do I miss something ??
    is there a workaround ?
    thx

  11. Carlos Galvis says:

    I’m working with netbeans 6.0, and everything works ok, my doubt is that I must use a template (dwt with his css file), Wich xml I must modify and how can I modify it to keep the template of my site?

  12. Peter says:

    Hi,
    I am trying this out. I am able to get form elements displayed, but it looks like images and css which are supposed to come from (context)/theme/com/sun/rave/web/ui/* are not being served. I copy the path from "view source" and put it directly in the browser and get a 403 from my app server. Is there something I need to configure?
    I get this message with the 403
    "Direct access to this Portlet Application’s resources has not been authorized"
    Thanks

  13. Tony says:

    Hi, I’m building a portlet using the Visual JSF Framework and Woodstock components in Netbeans 6.1. My portlet just displays a table with the data collected from a MySQL database (a basic ‘Select All’ from a table). I am using Liferay 5.1.2 bundled with Tomcat 6.0 on Windows 2000. The portlet deploys fine in Liferay (after a server restart), my problem is that the data is not displayed in the table. My guess is that I have a problem connecting to the MySQL database inside my portlet. I have tried several things like including the Database Resource definition in the context.xml for Tomcat and also in the Root.xml, but I get the same results. My table keeps displaying "No items found". The table is displayed correctly as a web application, the problem comes when deploying as a portlet. Am I missing something? Any help is appreciated, thanks.

  14. satya says:

    Could you please explain, how do you accessing database to get data ?
    FYI, automatic data binding through drag and drop of database table to visualweb jsf table is not possible for the portlet. You have to do it manually.

  15. Tony says:

    Thanks for the reply. To answer, yes, I was doing it by dragging and dropping the database table to the JSF table. How can I bind the data manually? Thank you very much for the help.

  16. Elley says:

    I have developed two Portals in one page and I set the view/edit/help on each JSF page, now my problem is when want to set another JSF page as view/edit or help on the other portal is not working it works for the first one. Please help guys. Thank you

  17. Satya says:

    Tony,
    It looks like the _init() method is not getting called in the Page.java(page java file) file. And user_DataProvider.setCachedRowSet() is called in _init() to set the CachedRowSet for the dataprovider. That’s why you are not able to see any data.
    Try calling _init() inside constructor of Page.java.
    But make sure you have added the datasource properly in your server.
    Looks like a bug in jsfportletbridge.

  18. Tony says:

    Hello Satya, thank you very much for the help. I finally got my table to retrieve the data from the MySQL Database inside my portlet with your method. I tested it and worked fine, but I encountered another small problem. It seems that Liferay is not displaying the Woodstock table properly. It displays most of it, but some areas of the background of the table are not being rendered. I have uploaded an example for you to see: http://img216.imageshack.us/my.php?image=mybitmaphx1.png. Is this a problem with Liferay displaying Woodstock components? Any help is greatly appreciated as always. Thank you.

  19. Elley says:

    I have created my portal on NetBeans 6.1 and is running, now i want to remove the picture and the name (Portlet Container Driver) that appears on the browser when I’m running the project.

  20. Fahd Helwani says:

    thank you for your effort explaining how to create jsf portlet, however I followed the instructions and I got an class cast exception while deploying to Liferay 5.1.2 on tomcat 5.5
    can you please help me on that please? I hope that you can send me something using email

  21. satya says:

    I will try that and let you know. But can you send me the exception stack you are getting during deployment ?

  22. Paedagogus says:

    Liferay on Tomcat appears to be a problem for JSR-286 (ie, IPC) and Visual JSF Portlet Pages. Download the Glassfish/Liferay bundle. That seems to work as expected.

  23. yi says:

    Thank you Paedagogus! I’ll try Glassfish/Liferay…
    I have a problem of reload with Tomcat/Liferay, it’s means I need reload page for display my portlet…
    What’s your problem?

  24. Mohammed Ali says:

    Hi, Thanks for this guid, I have problem in displaying jsf controls, like table in a jsf portlet, error "webui is undefined" appears. My Environment is:
    1- Netbeans 6.5.0.
    2- Glassfish V2.0.
    3- Webspace 10.x.
    4- PortalPack 3.0.
    5- JSF Portlet Bridge Library.
    Please, any help will be so appreciated.
    Thank You.

  25. Aswatham Aruna says:

    Hi,
    My nameis Aruna.
    I am developing portlets using Glassfish Webspace server and frameworks used are JSF and Spring.Can anybody help me to display the results page retreived from database.Some how i was able to display the results page but with no data.I am not able to see any error in the log file also.please help me ASAP.

  26. satya says:

    May be the following reply to one of the comments in my blog helps
    >>>
    It looks like the _init() method is not getting called in the Page.java(page java file) file. And user_DataProvider.setCachedRowSet() is called in _init() to set the CachedRowSet for the dataprovider. That’s why you are not able to see any data.
    Try calling _init() inside constructor of Page.java.
    But make sure you have added the datasource properly in your server.
    >>>

  27. Dennis says:

    "FYI, automatic data binding through drag and drop of database table to visualweb jsf table is not possible for the portlet. You have to do it manually."
    I do not know if anybody is still reading but is there a howto for that task anywhere?
    Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s