Netbeans 6.8 beta : support de JSF 2 et PHP 5.3

February 1, 2010 · Leave a Comment
Filed under: Featured, JAVA, NetBeans 

La version 6.8 de Netbeans est disponible en version beta. Parmi les principales avancées proposées, on relève le support de JavaFX 1.2.1 (qui n’était pas présent dans la dernière version de travail).




Netbeans 6.8 supporte en outre JavaServer Faces 2.0 et Java Persistence JPA 2.0 Web Services Restful, ainsi que GlassFish 3. Sur le terrain de PHP, l’environnement de développement intègre la version 5.3 du langage, et supporte l’infrastructure Symfony. Enfin, la prise en charge des langages C/C++ et Ruby, et la combinaison de l’IDE avec Maven et JRuby sont améliorés.

Télécharger Netbeans 6.8 beta

Installing the Qt Framework on Netbeans IDE 6.7

November 27, 2009 · Leave a Comment
Filed under: Featured, NetBeans 


Installing the Qt Framework on Netbeans IDE 6.7. Installing the Qt Framework: You can download the Qt framework for your Windows, Linux, or Mac OS X platform from www.qtsoftware.com/downloads. If you are using a Solaris platform,


NetbeansX – http://netbeansx.blogspot.com/

adding files in netbeans : java cms

September 5, 2009 · Leave a Comment
Filed under: Featured, NetBeans 

I am wondering if anyone know how to set netbeans in a way then whenever it compiles, it would also automatically add some configuration files I made into the distribution it made ? I have decided to use simple log for my logging and it have some configurations I need to add it to my the classpath. How do I get netbeans to do so too.

I am using netbeans 6.5.1.

set up liferay-portal with netbeans 6.5 – Community forums – Liferay

September 4, 2009 · 2 Comments
Filed under: CMS, Featured, IDE Tools, LifeRay, NetBeans 

Basic Configuration

Download Netbeans IDE and install it. Be careful with you will need Java Development Kit installed on you computer. Well, you can get Netbeans bundled with JDK here.

After that, download Liferay Source Code from here. You find it in the end of the page, in the section Files for Developers.

When you have installed Netbeans IDE and running, you add a new project called liferay.

640px

Building Stand-alone Portlets

To create a portlet application that resides in a stand alone .war file, you will need Netbean’s Portal Pack. Then you will add some liferay specific functionality to prove you can, and deploy it to Liferay.

You will need:

  • The Portal Pack, just the plugin, not the app server or portlet container
  • Liferay code > 4.2.1 ( i used svn co https://svn.sourceforge.net/svnroot/lportal/portal/trunk )
  • To have built the ext environment because we’ll use some services to make the tutorial worth while
  • To create the library tutorial service section of one of the many tutorials like this one. We’ll only use the db objects and services created in these tutorials.
  • For deployment, I’m using the liferay-jboss-tomcat bundle but it should work with any other bundle

Creating the Portlet App

Note: If you are using Netbeans 6.0 beta 1, the following instructions do not apply to you since the Portlet support has been added to the webapp support. Please refer to the Netbeans site for more details.

  1. Create New Project by clicking File/New Project
  2. From the New Project wizard, choose Portlet Applications in the Categories sechtion and then JSR-168 Portlet Application in the Projects section. Click Next >
  3. Provide a Project Name and you can choose to leave or change the rest of the stuff. Click Finish

As it is the project has been created, you could right click in the project in the Projects window and choose Clean and Build Project, which will create a .war file in the projects dist folder that can be hot deployed to Liferay using the Admin portlet.

The wizard created a class file for you, we’ll call it your portlet class from now on. The wizard also created 3 jsp files for you, we’ll only change the view.jsp which can be found in the Web Pages/WEB-INF/jsp node in the Projects window. You can see that your portlet class points to that path and file in the doView method.

Adding Liferay’s stuff

To make this tutorial worth your while, we’ll use some Liferay specific methods and objects. We’ll create a portlet that presents a simple form similar to the one you may have done in the library struts portlet, which will create books and will list the books’ in a very ugly table…

First, we want to add to Netbeans all the dependencies of our project using the Library Manager found in the Tools menu. We could add the dependencies directly to the project but then we would have to do it for every portlet.

  1. Click on Tools/Library Manager, which brings up the, well, Library Manager
  2. Click on the New Library button, name your library Liferay
  3. In the Classpath tab, add the following jars that must have been created if you did the library tutorial for struts or jsf
    1. portal-kernel.jar found in liferay’s code in the portal-kernel folder
    2. portal-service.jar found in liferay’s code in the portal-service folder
    3. ext-ejb.jar found in your ext environment in the ext-ejb folder
    4. ext-service.jar found in your ext environment in the ext-service folder
  4. Add the sources if you want, as well as the documents, then click Ok

Now we need to add the library to the project.

  1. Right clicking on the project in the project window and selecting Properties
  2. Select Libraries from the Categories section.
  3. Click Add Library and select Liferay then Click Add Library
  4. Uncheck any checks in the Package column, you don’t need to deploy these with your jar, they are only good for autocompletion, compilation, etc.
  5. Click Ok

Code Stuff

We’ll pass some data to the view and add an action method to your portlet class.

Your doView method will look like this:

    public void doView(RenderRequest request,RenderResponse response) throws PortletException,IOException {

        // we just want to show we can use some liferay's stuff here   
        try {
            if (PasswordTrackerLocalServiceUtil.isValidPassword("test@liferay.com", "test")) {
                System.out.println("--------- El passowrd es valido!!! -------");
            }
        } catch (Exception e) {
            System.out.println("------- Error: " + e.toString());
        }

        // we want to get a list of books (from the library tutorial) and pass them to the view.jsp
        try {
            // wrapper in BookLocalServiceUtil which returns BookUtil.findAll(), from library tutorial
            List<Book> books = BookLocalServiceUtil.getAll(); 
            request.setAttribute("books", books);

        } catch (Exception e) {
            System.out.println(" ---- Error en el libro!!! --- "+e.toString());
        }

        response.setContentType("text/html");
        PortletRequestDispatcher dispatcher =
                getPortletContext().getRequestDispatcher("/WEB-INF/jsp/view.jsp");
        dispatcher.include(request, response);

    }

Now add to the following method to the same class

    public void proessAction(ActionRequest request, ActionResponse response) throws PortletException, IOException {
        try {
            System.out.println(request.getParameter("action"));
            BookLocalServiceUtil.addBook(request.getRemoteUser(), request.getParameter("book_title"));
        }catch(Exception e){
            e.printStackTrace();
        }
    }

By now your code probably has tons of little red underlines, meaning you have erros… These are due to import problems… Netbeans will fix them for you if you right click on the code window and select Fix Imports

Your code should be able to compile now.

View Stuff

We’ll change the view.jsp file to display the books and be able to add more. In the end, your jsp should look like this:

  <%@page contentType="text/html"%>
  <%@page pageEncoding="UTF-8"%>
  <%@page import="javax.portlet.*"%>
  <%@taglib uri="[http://java.sun.com/portlet"] prefix="portlet"%>
  <portlet:defineObjects />
  <%PortletPreferences prefs = renderRequest.getPreferences();%>
  <%@ taglib uri="[http://java.sun.com/jsp/jstl/core"] prefix="c" %>
  Some books 
  <table border="1">
    <c:forEach var="book" items="${requestScope.books}">
        <tr>
            <td><c:out value="${book.bookId}"/></td>
            <td><c:out value="${book.userId}"/></td>
            <td><c:out value="${book.title}"/></td>
        </tr>
    </c:forEach>
  </table>

  <form action="<portlet:actionURL
      windowState="<%= WindowState.NORMAL.toString() %>">
      <portlet:param name="action" value="addBook"  /></portlet:actionURL>"
      method="post" name="<portlet:namespace />fm">
   Book Title:
   <input name="<portlet:namespace />book_title" size="20" type="text" value="">
   <input type="button" value="Submit" onClick="submitForm(document.<portlet:namespace />fm);">
  </form>

That is about it! if you do Clean and Build Project you should be able to hot deploy the .war file and see your portlet work!

Efficient Deployment

I modified my build script in netbeans so that when I clean and build the project it is hot deployed to the server.

Click on the Files window, find the build.xml file in your project, open it and add the following to the end of it:

    <target name="-post-dist">
        <!-- want to delete work forlder in jboss to prevent jsp caching-->
        <basename property="portlet.work.name" file="${dist.war}" suffix=".war"/>
        <delete dir="${user.home}/Java/liferay-portal-jboss-tomcat-4.2.1/server/default/work/jboss.web/localhost/${portlet.work.name}" />
        <!-- want to copy to liferay's deploy folder -->
        <copy file="${dist.war}" toDir="/home/liferay/deploy" />
    </target>

With this, and the hot deploment setting in the Admin portlet set to 5 seconds, i’m able to do changes in the code and rebuild the project with almost no wait time (6 seconds or less at the moment).

Debugging

If you know how to start your apps server in debug mode, and tell Netbeans to put debug symbols in the build (look at the Properties/Build/Compiling/Generate Debugging Info checkbox), you can tell Netbeans to connect to a remote server by clicking on the Attach Debugger icon or menu item, set the right port and then set breakpoints in your code as with any other app…

Netbeans Profiler

leaks or performance profiling, I recommend the NetBeans profiler. It’s a free, but powerful profiler: http://www.netbeans.org

To install:

  1. Install Netbeans IDE 5.5
  2. Install Netbeans Profiler 5.5
  3. For profiling JDK 1.4.2 applications, download Netbeans JFluid Modified JDK, then from the Tools|Update Center, choose “Install Manually Downloaded” to install. Then do this step once: Profile|Advanced Commands|Run Profiler Calibration
  4. For profiling JDK 1.5+ applications, no additional downloads required. JDK 1.5+ has the new JVM Tool Interface API.

To run the profiler:

  1. Go to Profile|Attach Profiler, click on Attach Wizard:
  2. Select Target Type: J2EE Web/App Server, Server Type: Tomcat 5.5
  3. For profiling with JDK 1.4.2: Target settings: Local, Dynamic Working dir: ..\servers\tomcat\bin, Attach using server PID
  4. For profiling with JDK 1.5+: Target settings: Local, Direct (cannot be dynamically attached)
  5. Click next, choose Automatic, click Next. Tomcat Installation: …\servers\tomcat
  6. Choose Server JVM
  7. click Next, click Next
  8. Check “Automatically start the server after this Wizard finishes.”
  9. click Finish

…or start manually from command-line in tomcat\bin:

 catalina_nbprofiler start

Next select a profiling task, then click Attach.

For info on using the profiler, read http://www.netbeans.org/kb/articles/nb-profiler-tutor-8.html

For faster server startup, use the “Monitor Application” task (the other profiling tasks require more resources). After the server has started up, then go to the Profiler | Modify Profiling… menu and select the new task.

For tracking down memory leaks, use the “Analyze Memory Usage” task with the “Record Stack Trace for Allocations” option checked. This shows where leaking objects were created. If this configuration crashes when you take a snapshot, then the workaround is to add this to the command line that starts the server:

  • Xnoclassgc

If you get a redefinition error on a generated JSP class while profiling Tomcat during a load test, then the JSPs need to be precompiled. To do this, add this to build.properties/build.${user.name}.properties then deploy again: jsp.precompile=on

JDK 1.4.2 notes: In older NetBeans/JDK 1.4.2 sometimes it couldn’t dynamically attach, but going through the Attach wizard works everytime. From the dropdown select the process and click OK.

Creating Portlets for Web Sites With the NetBeans IDE

June 29, 2008 · Leave a Comment
Filed under: Featured, JAVA, Portlets 
A portal is a web page that contains individual and customizable web applications. For example, My Yahoo is a portal page. The portal provides value-added services, such as single sign-on, customization, content aggregation, and localization.

Individual web applications that are added to the portal page are called portlets. A portlet is a Java technology web component that is based on the JSR 168 specification and JSR 286, which includes Web Service for Remote Portlets (WSRP). Portlets are managed by portlet containers that supply dynamic content. Portals employ portlets as pluggable user-interface components that provide users with desired content such as RSS feeds, mashups of services such as the current weather in a given area, or even static content such as a group of hyperlinks.

In the past, creating portlets was a complex process. Now, you can quickly and easily create and test portlets using the NetBeans IDE 6.0 and the OpenPortal Portlet Container 2.0 Beta 2. Deploying the portlets onto the server is also simple.

This article shows you how to create portlets and provide dynamic content through drag-and-drop widgets in the NetBeans IDE. The example portlet in this article uses the jMaki Tabbed View widget, pulls in RSS feeds, and uses static links from the New to Java Programming Center.

What You Need to Get Started

To create and test portlets, you need the following software installed on your computer:

For instructions on installing the OpenPortal Portlet Container 2.0 Beta 2, see the installation page. You must download and install the OpenPortal Portlet Container before you follow the next steps.

The portlet container works similarly to servlet containers. A portlet container does the following:

  • Provides the runtime environment for portlets
  • Manages the life cycle of portlets
  • Provides persistent storage for storing portlet preferences
  • Caches the portlets
  • Receives requests from the portal to execute requests on the portlet

Once you have installed the necessary software, start the NetBeans IDE. Next, install the portlet and portlet container plug-ins by following these steps:

  1. Go to Tools in the main menu.
  2. Select Plug-ins.
  3. Click on the Available Plug-ins tab.
  4. Check the boxes for Portlets, the OpenPortal Portlet Container, and jMaki Ajax Support.
  5. Click the Install button and follow the directions from there. You may need to accept a few licenses before the installation process can complete.

Lastly, add the OpenPortal Portlet Container server:

  1. Go to Tools in the main menu.
  2. Select Servers.
  3. Click on Add Server.
  4. Select OpenPortal Portlet Container 2.0 from the list.
  5. Click Next.
  6. Use Browse to set the location in which to install the GlassFish application server. You may need to search your system separately to discover where the NetBeans IDE installed the GlassFish application server.
  7. Click OK.

You are now ready to create a portlet.

Creating a Portlet Project

As you do whenever you create an application in the NetBeans IDE, go to File > New Project, and choose Web > Web Application, then click Next. For the name of this project, type New2JavaPortlet. In the Server drop-down menu, choose OpenPortal Portlet Container 2.0 Beta, then click Next. In the next screen, check the jMaki Ajax Framework box. In the lower half of the pane, you get a selection of layouts. Scroll to the bottom, and choose No CSS Style.

Lastly, at the top of the screen, check the Portlets Support box. Use the Portlet Version drop-down menu and select 2.0, then check the Create Portlet box. In Portlet Class Name, type New2JavaPortlet. Note that the project name and the portlet name must be the same. The other fields are filled in automatically. Click Finish.

Because of the way that portlets are set up within the container, you will not need the displayed index.jsp page. On the left side of the screen, under the Projects tab, you see index.jsp listed. Right-click on index.jsp and select Delete. The file you are going to work on is named New2JavaPortlet_view.jsp. You can find that file by expanding the WEB-INF directory, then the jsp directory. Double-click the file name New2JavaPortlet_view.jsp The file now opens in the workspace.


How the Java Portlet Works

Even though all you’ve done is create a portlet project, the NetBeans IDE has already written an essential class for you. From the Projects tab, expand the Source Packages. Then expand com.text, and open the file New2JavaPortlet.java by double-clicking the file name.

The New2JavaPortlet extends a GenericPortlet class, which is provided, that implements the render() method and delegates the call to more specific methods to display the portlet based on its mode. Developers can extend GenericPortlet and implement as many of the following specialized render methods as are necessary for their portlet:

  • doView() Called by render() when the portlet is in View mode. Intended to contain logic that displays the View page for the portlet.
  • doEdit() Called by render() when the portlet is in Edit mode. Intended to contain logic that displays the Edit page for the portlet.
  • doHelp() Called by render() when the portlet is in Help mode. Intended to contain logic that displays the Help page for the portlet.

Notice that the New2JavaPortlet calls these methods, locating the pages for each. In this article, you will put the content of the portlet in the View page through drag-and-drop widgets and some HTML code. But you can extend this GenericPortlet cl

ass for other portlets. You can also go back later and modify the Edit or Help page. Once you have had a good look at the New2JavaPortlet class, you can close it.

When you build and run the portlet, the browser will display the New2JavaPortlet_view.jsp. Currently, this page contains only the static text: New2JavaPortlet – VIEW MODE. Because it is a JavaServer Pages (JSP) technology page, you can add any scripts or JSP tag libraries that you wish, and treat it like any other JSP page.

Test your portlet environment now before adding more content: From the main menu, click Build and select Build Main Project. Once the build is successfully completed, go to the main menu and click Run. Select Run Main Project. This takes a little longer as the application server is started, the portlet container is started, and a browser window is opened.

Notice that the portlet project name is the same as the portlet itself. Once you see that your development and testing environments are working properly, you can add content to replace the static text on the New2JavaPortlet_view.jsp page. To see the changes that you make to your portlet, you undeploy and deploy the portlet, as explained in the next section.

Adding Dynamic and Static Content to the Portlet

Because this portlet will contain several kinds of content, organize the content for a small area on a web page by using tabbed panes. You can choose other types of layouts, of course, but for this example, use the jMaki widget named Tabbed View. On the right side of your screen, notice that you have many available widgets to drag and drop. Check to be sure that the jMaki Yahoo widgets list is expanded .

Within the workspace page, delete the static text that says New2JavaPortlet - VIEW MODE. Also, delete the surrounding HTML code for bold: <b></b>. Now drag and drop the Tabbed View widget, shown highlighted in white , from the palette onto the page, exactly where you have just deleted text. Once you have dropped the Tabbed View widget onto the page, the following code appears on the page:

<a:widget name="yahoo.tabbedview"
   value="{items:[
           {label : 'My Tab', content : 'Some Content'},
           {id : 'bar', label : 'My Tab 2', include : 'test.jsp ', lazyLoad : true },
           {label : 'My Tab 3', content : 'More Content',  selected : true}
          ]
         }" />

The action of dragging and dropping a jMaki widget onto the page causes the creation in the resources directory of all the files necessary to build that widget.

To get an idea for how this widget works, save the file. Next, right-click the project name in the Projects pane and select Undeploy and Deploy. Once it is built, run the project: Go to the main menu, click Run, and select Run Main Project. When the project runs, your changes appear in the browser window. Click on each of the tabs in the Tabbed View pane. Notice on the tab named My Tab 2 that the file test.jsp was not loaded. This is only because a test.jsp had not been created, but it does demonstrate how you call a JSP page to appear in the pane.

For the New2JavaPortlet, you are going to create new JSP pages that the widget will call. Each of these pages provides the content for each of the tabs. On the New2JavaPortlet_view.jsp page, replace the code shown earlier with the following code:

<a:widget name="yahoo.tabbedview"
   value="{items:[
           {id : 'bar', label : 'Popular & New', include : '/New2JavaPortlet/whatsnew.jsp ', selected : true },
           { label : 'Java Fundamentals', include : '/New2JavaPortlet/fundamentals.jsp ', lazyLoad : true },
           { label : 'Downloads', include : '/New2JavaPortlet/downloads.jsp ', lazyLoad : true },
          ]
         }" />

This code calls three JSP pages: whatsnew.jsp, fundamentals.jsp, and downloads.jsp.

The next step is to create those pages. In the Projects pane, right-click on Web Pages. Then select New, and lastly JSP. Notice that you are saving these pages into the Web Pages directory, not the jsp directory that the portlet container created for the New2JavaPortlet_view.jsp. Any JSP pages that you create must go into the Web Pages

Create three JSP pages in this manner, naming them whatsnew, fundamentals, and downloads. The NetBeans IDE automatically adds the .jsp extension, so don’t include that in the file name.

Next, run Undeploy and Deploy again. Then click on the Run menu, and select Run Main Project. This time, note that the tab names have changed. As you click on each tab name, you get the JSP pages that you just created because of the code you replaced. Open each of these JSP pages — downloads.jsp, fundamentals.jsp, and whatsnew.jsp — and add content as described in the following subsections.

The downloads.jsp Page

This page contains simple static content, a title, and a list of links. Do not change the first two lines of code that appear at the top of the page:

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

But replace all of the HTML code with the following:

<h3>Downloads for New Developers</h3>
 
<ul>
  <li><a href="http://java.sun.com/javase/downloads/i">Java SE (JDK)</a>
  <li><a href="http://www.netbeans.org/">NetBeans IDE</a>
  <li><a href="http://www.mysql.com">MySQL Database</a>
</ul>

The fundamentals.jsp Page

This page will provide dynamic content, pulling in an RSS feed. Again, leave the first two lines of code alone, and remove all of the HTML code. Next, from the jMaki Widgets palette on the right side of the display, drag and drop the Block List widget onto the page.

The following code should appear on your page:

<a:widget name="jmaki.blockList" value="[
{title : 'jMaki Project Home', link : 'https://ajax.dev.java.net', description : 'Where to go for the latest jMaki.' },
{title : 'jMaki Widgets Home', link : 'https://widgets.dev.java.net', description : 'The source for the latest jMaki widgets.' },
{title : 'jMaki-Charting Home', link : 'https://jmaki-charting.dev.java.net', description : 'Enables complex charts rendered on the client in any modern browser.' }
]"  />

The widget prov

ides placeholder text only. Replace everything with the following code:

<h3>Java Technology Fundamentals</h3>
 
<a:widget name="jmaki.blockList" service="/xhp?id=rss"  />

In order to populate the widget with data from an external service, such as an RSS feed, you must replace the value attribute with service="/xhp?id=rss". If any page consists of a jMaki widget, then the jMaki runtime is bundled with the application. The runtime consists of jmaki.xhp.XmlHttpProxyServlet class that maps to the /xhp URL pattern within the application context.

The identifier or ID specified in the URL, rss, is configured in a configuration file named xhp.json. This file consists of a list of default external services that the widgets in a page can access. You can specify each entry in the xhp.json file by using up to five different parameters:

  • ID: This required parameter is a unique identifier for the entry.
  • URL: This required parameter gives the location of the external service.
  • Parameters: These optional parameters specify the default values passed to the URL.
  • API key: This is an optional parameter to invoke the service with a specific key.
  • Stylesheet: This is an optional parameter to process the response.

Next, you must change the xhp.json file. Go to the Projects tab and expand the resources directory. Double-click the file xhp.json, and scroll to the bottom of that page. Search for this code in the xhp.json file:

{"id": "rss",
      "url":"http://weblogs.java.net/blog/ludo/index.rdf",
      "xslStyleSheet": "rss.xsl"
  }

The tag and the default entry tell the jMaki runtime to fetch the RSS feed from http://weblogs.java.net/blog/ludo/index.rdf, apply the rss.xsl stylesheet — which understands the multiple RSS/Atom formats — to the received response, and convert the data into a common JavaScript Object Notation (JSON) data format of the type "dataType" : "jMakiRSS". The jMaki Block List widget can convert jmakiRSS data to its specific data model.

But the intention of this article is not to pull in Ludovic Champenois’s blog. So change the URL of http://weblogs.java.net/blog/ludo/index.rdf to http://blogs.sun.com/JavaFundamentals/feed/entries/rss.

Additionally, you will pull in another feed on the whatsnew.jsp page, so change the URL in the code as shown in the following code snippet. The new URL is highlighted in red.

{"id": "rss2",
      "url":"http://blogs.sun.com/new2javaUpdates/feed/entries/rss",
      "xslStyleSheet": "rss.xsl"
   }

Notice that the ID for the second RSS feed to pull in is named rss2. Notice also that the URL pulls in the blogs from the “What’s New” section of the New to Java Programming Center. Save the xhp.json file. Because you’ve added another block of code to pull in the second feed, you must separate the two
with a comma after the closing curly bracket (}) of the first block. The following code snippet shows the added comma in red on the fourth line:

    {"id": "rss",
      "url":"http://blogs.sun.com/JavaFundamentals/feed/entries/rss",
      "xslStyleSheet": "rss.xsl"
     },
    {"id": "rss2″,
      "url":"http://blogs.sun.com/new2javaUpdates/feed/entries/rss",
      "xslStyleSheet": "rss.xsl"
     }

The whatsnew.jsp Page

Go to the whatsnew.jsp page, and delete the HTML code. Add the following static HTML code:

<h3>What's Popular</h3>
 
<ul>
  <li><a href="http://java.sun.com/docs/books/tutorial/">The Java Tutorial</a></li>
  <li><a href="http://blogs.sun.com/JavaFundamentals/">Java Technology Fundamentals</a></li>
  <li><a href="http://blogs.sun.com/CoreJavaTechTips/">Core Tech Tips</a></li>
  <li><a href="http://java.sun.com/developer/onlineTraining/tools/netbeans/">Easy Web Site Creation in the NetBeans IDE</a></li>
  <li><a href="http://java.sun.com/javaee/5/docs/tutorial/doc/">The Java EE 5 Tutorial</a></li>
</ul>
 
<h3>What's New</h3>

Next, from the jMaki Widgets palette on the right side of the display, drag and drop the Block List widget onto the page. Change the code as shown here:

<a:widget name="jmaki.blockList" service="/xhp?id=rss2"  />

Customizing the jMaki Widgets

All the files that you need for customizing any of the widgets are available in the resources directory by widget name. In this case, look under jMaki for the files for the block list. Expand the blocklist directory, and open the file called component.css.

Change the line that says height : 85px; to height : 25px; and save the file.

Next, open the component.html file, and delete the following code from it:

<br/>
@{description}<br/>

This removes the descriptions from the RSS feeds, leaving only the title as a link. You can also add content, such as a date, by adding it to this file. Now, save all the files, click Undeploy and Deploy, then run the portlet again by clicking on Run in the menu and selecting Run Main Project.

Again, click Undeploy and Deploy. Then click Run the application. You now see the pages that you

‘ve created with the content. Notice also that the block list is taking up a lot of room. You can customize jMaki widgets easily by going to the Projects tab, expanding the resources directory, expanding the jMaki directory and then blockList. Edit component.css so that the height is just 25 pixels (25px).

Click Undeploy and Deploy again. When you run the portlet.

Your portlet is now complete. Once the portlet is deployed, users can add the portlet to their portal page and have access to the information they want on their page. You can tailor portlets in many different ways to suit the needs of your web site. The NetBeans IDE provides many widgets that you can drag and drop, but you are not limited by what that palette provides. You can also create your own widgets, or use Java code to create an unlimited number of objects to get the functionality that you want.

The next step is to archive the entire project in a ZIP file and send it to the server administrator. If you are also the server administrator, read the next section.

Packaging and Deployment

The portlet specification specifies the packaging and deployment of portlets as part of standard Web Application Archive (WAR) files that may contain other web components, such as JSP pages and servlets. In addition to the web.xml deployment descriptor now found in WAR files, the portlet.xml file in the WEB-INF directory descriptor defines all portlets and portlet-related configurations. An XML schema included in the portlet specification JSR 168 defines the standard elements for portlet configuration stored in the portlet.xml file.

Each portal-server vendor must provide a tool to parse the portlet descriptor file and deploy the portlet. These tools likely exist in GUI form as well as in command-line form. Developers will be able to integrate the command-line deployment tools with the Apache Ant tool. This creates additional development environment possibilities, because most development tools provide an interface for Apache Ant.

To deploy the project onto the server, see the documentation for your portal server for complete details. Most portal servers will allow you to deploy the WAR file, which is located in your project’s dist directory after you perform a build. Depending on your portal server, this may be deployed by using the Ant command, copying the WAR to your portal autodeploy directory, or using the administrative feature of your portal server.

Summary

Now that you have created a portlet, you can create other types of portlets for the portal page for your users. Portlets can include components such as local weather, the latest news, live sports scores, maps, and RSS feeds from other sites. Portlets allow your users to customize the web page to meet their specific needs, and this keeps them coming back to your web site.

For More Information

See Also http://java.sun.com/devel

oper/technicalArticles/tools/nb_portlets/?cid=925028

configure CVS connection

June 29, 2008 · Leave a Comment
Filed under: CVS, Featured 

How do I configure CVS connection settings?

  • You can specify connection settings in the Checkout wizard. Settings are persistently stored.

For example, to check out NetBeans sources, choose Versioning > Checkout (or Versioning > CVS > Checkout) from the main menu and use :pserver:anoncvs@cvs.netbeans.org:/cvs with empty password for anonymous checkout. Alternatively use your own NetBeans.org login and password instead of anoncvs.

  • Otherwise, the IDE uses automatic configuration detection (probing common cvs setup files). Open the Favorites window, and right-click to add and open an existing repository directory. If the cvs session fails, the IDE shows the connection configuration dialog so you can change the settings (e.g. configure a proxy).

Applies to: NetBeans 6.x, 5.x