Building a simple feed reader with PrimeFaces 3.0 and Netbeans 7 (with Maven) that talks to Apache Abdera

Post to Twitter

PrimeFaces is a lightweight open source component suite for Java Server Faces 2.x. The PrimeFaces team is working on an upcoming 3.0 release which offers a lot of new functionality and components. One new component is the FeedReader. Today I’m going to demo how to use the new FeedReader to talk to Apache Abdera and to get a feed back.


For the Apache Abdera part of this demo please see the Apache Abdera Server article I did located here. I’ll use that source code to power the feed server that we will talk to with the PrimeFaces FeedReader.

Assuming now that you have the Abdera server up and running (you can populate some data into it with the Abdera Client project I created – the article is here). Make sure the Abdera server is up and running and has some data in it.

In Netbeans 7 create a new Maven Java Application.

You can name the project: PrimeFacesReader

Next we will need to add some dependencies to the POM file. You can right-click on the Dependencies folder and add them that way or you can take the code below and add it in manually. Make sure though you add the PrimeFaces repository.

I’m also going to use Jetty 8 embedded to power all of this. Keep in mind the PrimeFaces FeedReader has a dependency on Rome.


    4.0.0

    com.giantflyingsaucer
    PrimeFacesReader
    1.0-SNAPSHOT
    war    

    PrimeFacesReader

    
        ${project.build.directory}/endorsed
        UTF-8
    
    
      
          
            prime-repo  
            PrimeFaces Maven Repository  
            http://repository.primefaces.org  
            default  
         
    

    
        
            org.mortbay.jetty
            jetty-maven-plugin
            8.0.1.v20110908
        
        
          
            org.primefaces  
            primefaces  
            3.0.M3
        
        
        
            com.sun.faces
            jsf-impl
            2.1.3_01
        
        
        
            com.sun.faces
            jsf-api
            2.1.3_01
        
        
        
            net.java.dev.rome
            rome
            1.0.0
        
        
        
            javax
            javaee-web-api
            6.0
            provided
        

        
            junit
            junit
            4.8.2
            test
        
    

    
        
            
                org.apache.maven.plugins
                maven-compiler-plugin
                2.3.2
                
                    1.6
                    1.6
                    
                        ${endorsed.dir}
                    
                
            
            
                org.apache.maven.plugins
                maven-war-plugin
                2.1.1
                
                    false
                
            
            
                org.apache.maven.plugins
                maven-dependency-plugin
                2.1
                
                    
                        validate
                        
                            copy
                        
                        
                            ${endorsed.dir}
                            true
                            
                                
                                    javax
                                    javaee-endorsed-api
                                    6.0
                                    jar
                                
                            
                        
                    
                
            
            
                org.mortbay.jetty
                jetty-maven-plugin
                8.0.1.v20110908
                
                    10
                    
                        /
                    
                
            
        
    


Right-click on the Web Pages folder now and add a new JSF file called index (the xhtml extension will be added automatically). You can delete the JSP page that was generated when you created the project. Your project should look like this:

The contents of the index.xhtml file are as follows:





	
	
	
		
          
              
            

Results:

Very simple, nothing fancy. Obviously you can do much more if you wish but this is the basics to get you going.

Post to Twitter

This entry was posted in Apache Abdera, Java, Netbeans. Bookmark the permalink.