You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by John Platts <jo...@hotmail.com> on 2008/03/11 17:47:58 UTC

Developing portlets for Jetspeed 2.1.3 using NetBeans 6.0

I have used NetBeans 6.0 to develop portlets for Jetspeed 2.1.3. I have even used NetBeans 6.0 with the Maven plugin to build the portal.

NetBeans 6.0 can be downloaded from the following website:
http://www.netbeans.org/

To install portlet development support in NetBeans 6.0, do the following:
1. Start NetBeans IDE 6.0.
2. Select Plugins from the Tools Menu.
3. Select the Available Plugins tab.
4. Ensure that the Generic Portlets plugin is checked under the Available Plugins tab.
5. Click on the Install button.

To develop an Hello portlet application that will work with Jetspeed using NetBeans 6.0, do the following:
1. Start NetBeans IDE 6.0.
2. Select New Project from the File menu.
3. Select Web under Categories and then select Web application under Projects.
4. Click on the Next button.
5. Under Project Name, enter helloportletdemoapp. Under Server, select the server that the Jetspeed 2 portal is running on. Under Java EE version, select J2EE 1.4. You can leave Set Source Level to 1.4 unchecked if you will be running this portlet application with a Java 5 or Java 6 VM. You should have Set Source Level to 1.4 checked if you need to run this portlet application with a Java 1.4 VM.
6. Click Next.
7. Under Frameworks, select Portlet Support and ensure that Portlet Support is checked.
8. In the Portlet Support Configuration Pane, set the following settings:
- Portlet Version: 1.0
- Check the Create Portlet and Create Jsps check boxes
- Set package to com.example
- Set portlet class name to HelloPortlet
- Under Portlet Mode, ensure that View is checked and that Edit and Help are unchecked
9. Click Finish.
10. Edit the HelloPortlet_view.jsp file that is created. The HelloPortlet_view.jsp file should now contain the following:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@ page import="javax.portlet.*"%>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>

<portlet:defineObjects />

<%
String userName = renderRequest.getRemoteUser();

if((userName == null) || (userName.isEmpty())) {
    userName = "World";
}
%>
<p>Hello, <%= userName %>.</p>

11. In the Projects pane, right click on helloportletdemoapp and select Properties.
12. In the Project Properties - helloportletdemoapp dialog box, select the Compiling category under Categories, and then check the Test compile all JSP files during builds. This ensures that the JSP files that will be included in the portlet application are valid JSP files.
13. Click OK.
14. In the Projects pane, right click on helloportletdemoapp and select Build to build the project and create the WAR file.
15. When the project is built, you should get a line similar to this if the build is successful:
Building jar: C:\NetBeans6Projects\helloportletdemoapp\dist\helloportletdemoapp.war
This line contains the path of the portlet application WAR file.
16. The WAR file that is created by the build needs to be copied manually to the <path of Jetspeed portal web application>/WEB-INF/deploy folder in order to successfully deploy the WAR to the Jetspeed portal.

I have built projects that use the Jetspeed-2 API and other APIs that are used by applications that are included in the Jetspeed-2 j2-admin and demo applications.

To include these APIs in NetBeans portlet application projects, the steps below need to be followed:
1. Under Files, select the helloportletdemoapp application (or another portlet application).
2. Select the nbproject folder under the helloportletdemoapp application.
3. Open the project.properties file.
4. Add these lines to your project.properties file:
file.m2.repo.dir=<directory of your Maven 2 repository>
file.reference.jetspeed-api-2.1.3.jar=${file.m2.repo.dir}/org/apache/portals/jetspeed-2/jetspeed-api/2.1.3/jetspeed-api-2.1.3.jar
file.reference.jetspeed-commons-2.1.3.jar=${file.m2.repo.dir}/org/apache/portals/jetspeed-2/jetspeed-commons/2.1.3/jetspeed-commons-2.1.3.jar
file.reference.pluto-1.0.1.jar=${file.m2.repo.dir}/org/apache/pluto/pluto/1.0.1/pluto-1.0.1.jar
file.reference.portals-bridges-common-1.0.4.jar=${file.m2.repo.dir}/org/apache/portals/bridges/portals-bridges-common/1.0.4/portals-bridges-common-1.0.4.jar
5. Change the javac.classpath line in your project.properties file to the following:
javac.classpath=\
    ${libs.Portlet-1.0-Lib.classpath}:\
    ${file.reference.jetspeed-api-2.1.3.jar}:\
    ${file.reference.jetspeed-commons-2.1.3.jar}:\
    ${file.reference.pluto-1.0.1.jar}:\
    ${file.reference.portals-bridges-common-1.0.4.jar}

Note that your javac.classpath line might contain additional libraries. If your javac.classpath contains additional libraries, you should add them after the ${file.reference.portals-bridges-common-1.0.4.jar} line, and each line except for the last line needs to be delimited with :\. For example, if your project depends on commons-dbcp-1.2.2.jar, commons-pool-1.2.jar, and commons-collections-3.2.jar, your javac.classpath should look like this:
javac.classpath=\
    ${libs.Portlet-1.0-Lib.classpath}:\
    ${file.reference.jetspeed-api-2.1.3.jar}:\
    ${file.reference.jetspeed-commons-2.1.3.jar}:\
    ${file.reference.pluto-1.0.1.jar}:\
    ${file.reference.portals-bridges-common-1.0.4.jar}:\
    ${file.reference.commons-dbcp-1.2.2.jar}:\
    ${file.reference.commons-pool-1.2.jar}:\
    ${file.reference.commons-collections-3.2.jar}

Note that commons-dbcp-1.2.2.jar, commons-pool-1.2.jar, and commons-collections-3.2.jar need to be included in your portlet application WAR. To do this, right-click on the helloportletdemoapp application or your other portlet application in the Projects window, and then select Properties. Select Libraries under Categories. Be sure that the Compile tab on the right hand side of the Project Properties dialog box is selected, and then be sure that Package is checked for commons-dbcp-1.2.2.jar, commons-pool-1.2.jar, and commons-collections-3.2.jar, and be sure that package is unchecked for Portlet 1.0(JSR 168) Library, jetspeed-api-2.1.3.jar, jetspeed-commons-2.1.3.jar, pluto-1.0.1.jar, and portals-bridges-common-1.0.4.jar. Click OK after these settings are set.

I have had success using NetBeans IDE 6.0 with its Generic Portlets plugin.

Using NetBeans IDE 6.0 with its Generic Portlets plugin provides the following advantages:
1. JSP files can be test compiled during the build process to ensure that they do not contain syntax errors.
2. The NetBeans IDE 6.0 has a nice UI for creating new portlets.
3. NetBeans IDE 6.0 allows you to easily debug portlet applications by attaching the debugger to the Tomcat instance that Jetspeed 2 is running on.

Has anyone else used NetBeans IDE 6.0 to develop portlets for Jetspeed 2.1.3?

The NetBeans IDE is extensible and has support for Ant build scripts, and even has support for Maven 2 projects with the Maven plugin.

_________________________________________________________________
Climb to the top of the charts! Play the word scramble challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan

RE: Developing portlets for Jetspeed 2.1.3 using NetBeans 6.0

Posted by John Platts <jo...@hotmail.com>.
I have created the WAR using the NetBeans IDE by right-clicking on the project and selecting build. I then copied the resulting WAR file to the WEB-INF/deploy directory of the Jetspeed portal, and the portlet works correctly.

NetBeans is capable of test-compiling JSP files in a project. Do you know of any other tools that can test-compile JSP files in a portal project? The JSP test-compile feature is a really nice feature of the NetBeans IDE 6.0.

Information about the portlet development components of the NetBeans IDE can be found at http://portalpack.netbeans.org

NetBeans can be used to develop applications that can be built with Ant-based scripts.

John Platts

> From: david@bluesunrise.com
> To: jetspeed-user@portals.apache.org
> Subject: Re: Developing portlets for Jetspeed 2.1.3 using NetBeans 6.0
> Date: Thu, 13 Mar 2008 17:22:15 -0700
> 
> 
> On Mar 11, 2008, at 9:47 AM, John Platts wrote:
> 
> > I have used NetBeans 6.0 to develop portlets for Jetspeed 2.1.3. I  
> > have even used NetBeans 6.0 with the Maven plugin to build the portal.
> >
> > Has anyone else used NetBeans IDE 6.0 to develop portlets for  
> > Jetspeed 2.1.3?
> >
> > The NetBeans IDE is extensible and has support for Ant build  
> > scripts, and even has support for Maven 2 projects with the Maven  
> > plugin.
> >
> I have not. But you should be able to develop your portlets with  
> NetBeans, and then build a WAR file.
> Drop that WAR file into a running Jetspeed's WEB-INF/deploy directory,  
> and it will pick it up and deploy it to Tomcat
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
> 

_________________________________________________________________
Climb to the top of the charts! Play the word scramble challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan

Re: Developing portlets for Jetspeed 2.1.3 using NetBeans 6.0

Posted by David Sean Taylor <da...@bluesunrise.com>.
On Mar 11, 2008, at 9:47 AM, John Platts wrote:

> I have used NetBeans 6.0 to develop portlets for Jetspeed 2.1.3. I  
> have even used NetBeans 6.0 with the Maven plugin to build the portal.
>
> Has anyone else used NetBeans IDE 6.0 to develop portlets for  
> Jetspeed 2.1.3?
>
> The NetBeans IDE is extensible and has support for Ant build  
> scripts, and even has support for Maven 2 projects with the Maven  
> plugin.
>
I have not. But you should be able to develop your portlets with  
NetBeans, and then build a WAR file.
Drop that WAR file into a running Jetspeed's WEB-INF/deploy directory,  
and it will pick it up and deploy it to Tomcat

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org