You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by xtof83 <ga...@gmail.com> on 2008/01/05 21:45:57 UTC

Porlet with JSF - Nothing is displayed

Hi everybody.

So I m testing pluto, and the jsf bridge etc... to know if its an
interesting technologie for my next project or not.

I create a simple portlet without JSF: work perfectly

Now I add JSF, and all the stuff around. The portlet is reconized, seems to
work well, but finally it is empty at the display.

I know there is a lot of things in the code followed, who is not usefully,
but I search on internet, and tried to combined many stuffs.

So an other question, is...In some othe application Im using now myfaces 1.2
... but portal technologies is based on 1.1.5 .... using 1.2 is going to be
a problem no ??

I want also know is porlets system is good to be used in the case like :
Having a breadcrumbs (one portlet) interacting with an other navigation bar
(other portlet) and a portlet with the content... (All this porlets are
going to have different content, by choosing different product - 4th
portlet...)

Or portal technologies is to heavy for this example of use ? thx

You dont need to answer all my question, but thx you.

My code for the first problem:

pom.xml :

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">

    <!-- Change this to something akin to your java package structure -->
    <groupId>com.test.portlet</groupId>
    <modelVersion>4.0.0</modelVersion>
    <!-- Version of this app -->
    <version>1.0</version>
    <!-- Base name of the war file without .war ext -->
    <artifactId>JSFSimplest</artifactId>
    <packaging>war</packaging>
    <name>${pom.artifactId}</name>
    <!-- Dependency Version Properties
======================================= -->
    <properties>
        <!-- Change this for a new Pluto version -->
        <pluto.version>1.1.4</pluto.version>
        <portlet-api.version>1.0</portlet-api.version>
        <servlet-api.version>2.4</servlet-api.version>
        <jsp-api.version>2.0</jsp-api.version>
        <junit.version>3.8.1</junit.version>

        <jetspeed.version>2.1.2</jetspeed.version>
        <javax.servlet.version>2.4</javax.servlet.version>
        <org.apache.maven.plugins.maven-surefire-plugin.version>2.1.3
        </org.apache.maven.plugins.maven-surefire-plugin.version>
        <velocity-tools.version>1.3</velocity-tools.version>
        <velocity.version>1.5</velocity.version>
        <spring.version>2.0.5</spring.version>
        <commons-beanutils.version>1.7.0</commons-beanutils.version>
        <commons-validator.version>1.1.3</commons-validator.version>
        <commons-digester.version>1.8</commons-digester.version>
        <commons-logging.version>1.1</commons-logging.version>
        <commons-collections.version>3.2</commons-collections.version>

        <struts.version>1.2.7</struts.version>
        <myfaces.version>1.1.5</myfaces.version>
        <tomahawk.version>1.1.5</tomahawk.version>
        <javax.servlet.jstl.version>1.0.6</javax.servlet.jstl.version>
        <taglibs-standard.version>1.0.6</taglibs-standard.version>
        <castor.version>0.9.4.3</castor.version>

       
<org.apache.portals.bridges.jsf-demo.version>1.0.3</org.apache.portals.bridges.jsf-demo.version>
       
<org.apache.portals.bridges.jsf.version>1.0.3</org.apache.portals.bridges.jsf.version>
    </properties>
    <!-- Application Dependencies -->
    <dependencies>
        <!-- Provided Dependencies -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>${servlet-api.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.portlet</groupId>
            <artifactId>portlet-api</artifactId>
            <version>${portlet-api.version}</version>
            <scope>provided</scope>
            <!-- Prevents addition to war file -->
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>${commons-logging.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>1.7.0</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>commons-digester</groupId>
            <artifactId>commons-digester</artifactId>
            <version>1.6</version>
        </dependency>
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.2.0</version>
        </dependency>
        <dependency>
            <groupId>commons-el</groupId>
            <artifactId>commons-el</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <groupId>myfaces</groupId>
            <artifactId>myfaces-api</artifactId>
            <version>${myfaces.version}</version>
        </dependency>
        <dependency>
            <groupId>myfaces</groupId>
            <artifactId>myfaces-impl</artifactId>
            <version>${myfaces.version}</version>
        </dependency>
        <dependency>
            <groupId>myfaces</groupId>
            <artifactId>tomahawk</artifactId>
            <version>${tomahawk.version}</version>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.portals.bridges</groupId>
            <artifactId>portals-bridges-jsf</artifactId>
            <version>${org.apache.portals.bridges.jsf.version}</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>${pom.name}</finalName>
        <plugins>
            <!-- configure maven-war-plugin to use updated web.xml -->
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                   
<webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
                </configuration>
            </plugin>
            <!-- bind 'pluto:assemble' goal to 'process-resources' lifecycle
-->
            <plugin>
                <groupId>org.apache.pluto</groupId>
                <artifactId>maven-pluto-plugin</artifactId>
                <version>${pluto.version}</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>assemble</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


in src/main/java/com/test/jsfsimplest/JSFSimplestPortlet.java :

package com.test.jsfsimplest;

import org.apache.portals.bridges.jsf.FacesPortlet;
import javax.portlet.*;
import java.io.*;

public class JSFSimplestPortlet extends FacesPortlet {
    public void doView(RenderRequest request, RenderResponse response)
            throws PortletException, IOException {
        super.doView(request, response);
    }
}



src/main/webapp/view/view.jsp :


<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix='portlet'%>
<portlet:defineObjects/>
<f:view>
   <h2>A JSF Portlet</h2>
   Hello
   <% if ( renderRequest.getUserPrincipal() == null ) { %>
   guest
   <% } else { %>
   <%=renderRequest.getUserPrincipal().getName()%>
   <% } %>!
</f:view>



src/main/webapp/WEB-INF/faces-config.xml :

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC
  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
  "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
  <application>
    <locale-config>
      <default-locale>en</default-locale>
      <supported-locale>fr</supported-locale>
    </locale-config>
  </application>
</faces-config>


src/main/webapp/WEB-INF/porlet.xml :

<?xml version="1.0" encoding="UTF-8"?>
<portlet-app
        xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
        version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
        id="com.test.jsfsimplest.JSFSimplestPortlet">
    <portlet id="JSFSimplest">
        <portlet-name>JSFSimplest</portlet-name>
        <display-name>JSF Simplest Portlet</display-name>
       
<portlet-class>com.test.jsfsimplest.JSFSimplestPortlet</portlet-class>
        <init-param>
            <name>ViewPage</name>
            <value>/WEB-INF/view/view.jsp</value>
        </init-param>
        <supports>
            <mime-type>text/html</mime-type>
            <portlet-mode>VIEW</portlet-mode>
        </supports>
        <supported-locale>en</supported-locale>
        <supported-locale>fr</supported-locale>
        <portlet-info>
            <title>JSF Simplest</title>
            <short-title>JSF Simplest Short Title</short-title>
        </portlet-info>
    </portlet>
</portlet-app>


src/main/webapp/WEB-INF/web.xml :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="WebApp_ID">
    <display-name>JSFSimplestPortlet</display-name>
    <description>The world's simplest JSF portlet</description>

    <!-- Faces Config -->
    <context-param>
        <param-name>javax.faces.application.CONFIG_FILES</param-name>
        <param-value>/WEB-INF/faces-config.xml</param-value>
    </context-param>
    <context-param>
        <param-name>contextConfigLocation</param-name>

       
<param-value>/WEB-INF/pluto-portal-driver-services-config.xml</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
        <param-value>true</param-value>
    </context-param>

    <!-- ### filter ### -->
    <!-- jsf -->
    <filter>
        <filter-name>extensionsFilter</filter-name>

       
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
        <init-param>
            <param-name>uploadMaxFileSize</param-name>
            <param-value>100m</param-value>
            <description>
                Set the size limit for uploaded files. Format: 10 - 10 bytes
10k -
                10 KB 10m - 10 MB 1g - 1 GB
            </description>
        </init-param>
        <init-param>
            <param-name>uploadThresholdSize</param-name>
            <param-value>100k</param-value>
            <description>
                Set the threshold size - files below this limit are stored
in
                memory, files above this limit are stored
                on disk. Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g -
1 GB
            </description>
        </init-param>
    </filter>
    <!-- jsf end -->
    <!-- pluto end-->

    <!-- ###  filter-mapping ### -->
    <!-- jsf -->
    <filter-mapping>
        <filter-name>extensionsFilter</filter-name>
        <url-pattern>*.jsf</url-pattern>
    </filter-mapping>
    <!-- pluto end -->

    <!-- ### listener ### -->
    <listener>

       
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
    </listener>

    <!-- Faces Servlet -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    </servlet>

    <!-- Faces extension mapping -->
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    <taglib id="PortletTLD">
        <taglib-uri>http://java.sun.com/portlet</taglib-uri>
        <taglib-location>/WEB-INF/tld/portlet.tld</taglib-location>
    </taglib>
</web-app>

-- 
View this message in context: http://www.nabble.com/Porlet-with-JSF---Nothing-is-displayed-tp14638890p14638890.html
Sent from the Pluto - User mailing list archive at Nabble.com.