Websphere portal server 6.1 + Spring + Primefaces

UI Components for JSF
Post Reply
hepi
Posts: 2
Joined: 12 Oct 2010, 13:09

12 Oct 2010, 13:15

I have not been able to make this technology stack work for me.

From previous threads I have learned that it can possibly made to work if one relies solely on Facelets in the presentation layer.

However, I would be very grateful if someone could assist in:
1. pointing out the appropriate portlet bridge
2. pointing out a stack of jar dependencies that is known to work
3. giving examples of the configuration files (web.xml, application-context.xml, portlet.xml, faces-config.xml etc.) that makes such an application work.

Thank you very much.

MikeSt
Posts: 8
Joined: 07 Aug 2010, 21:19

16 Oct 2010, 15:51

The following setup is working for us:

1. Portlet bridge: https://jsfportletbridge.dev.java.net/
2.
  • a)JSF 1.2 RI
    b) Facelets 1.1.15 for JSF 1.2
    c) Spring 3.0.2.RELEASE
    d) Spring Webflow 2.1.0.M2 (optional)
    e) PrimeFaces 1.1
f) You MUST run in mode PARENT_LAST.

3. web.xml:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>ManagerInfo-Portlet286</display-name>
	<context-param>
		<description>
		</description>
		<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
		<param-value>server</param-value>
	</context-param>
	<context-param>
		<description>
		</description>
		<param-name>javax.faces.CONFIG_FILES</param-name>
		<param-value>/WEB-INF/faces-config.xml</param-value>
	</context-param>
	
	<context-param>
		<description></description>
	    <param-name>........Spring context in some form or another............</param-name>
	    <param-value>
	     ..........................
	    </param-value>
	</context-param>
	
	<context-param>
	    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
	    <param-value>.xhtml</param-value>
	</context-param>
	
	
	<!-- Enables special Facelets debug output during development -->
  	<context-param>
        <param-name>facelets.DEVELOPMENT</param-name>
   		<param-value>false</param-value>
  	</context-param>
  	
  	<!-- Causes Facelets to refresh templates during development -->
  	<context-param>
  		<param-name>facelets.REFRESH_PERIOD</param-name>
  		<param-value>1</param-value>
  	</context-param>
  	
  	<context-param>
	    <param-name>facelets.VIEW_MAPPINGS</param-name>
	    <param-value>*.xhtml</param-value>
	  </context-param> 
	  
	  <context-param>
	    <param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
	    <param-value>false</param-value>
	  </context-param> 
	  
	  
	  
	  <context-param>
	    <param-name>facelets.RESOURCE_RESOLVER</param-name>
	    <param-value>org.springframework.faces.webflow.FlowResourceResolver</param-value>
	  </context-param>
	  
	  <context-param>
	    <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
	    <param-value>false</param-value>
	  </context-param> 
	  
	  
	<context-param>
		<description>
			If set to true while server-side state saving is being used, a serialized representation
			of the view is stored on the server. This allows for failover and sever clustering support.
			Default is false.
		</description>
		<param-name>com.sun.faces.enableHighAvailability</param-name>
		<param-value>false</param-value>
	</context-param>
	  

	
	<listener>
		<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
	</listener>
	

	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	
	

	<!-- Serves static resource content from .jar files such as spring-faces.jar -->
	<servlet>
		<servlet-name>Resources Servlet</servlet-name>
		<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
		<load-on-startup>0</load-on-startup>
	</servlet>
	

	<servlet>
		<servlet-name>ViewRendererServlet</servlet-name>
		<servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	
	
	<!-- The front controller of this Spring Web application, responsible for handling all application requests -->
	<servlet>
		<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value></param-value>
		</init-param>
		<load-on-startup>2</load-on-startup>
	</servlet>
	
	<servlet>
		<servlet-name>Faces Servlet</servlet-name>
		<servlet-class>
		javax.faces.webapp.FacesServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	
		<servlet> 
                 <servlet-name>Prime Resource Servlet</servlet-name> 
                 <servlet-class>org.primefaces.resource.ResourceServlet</servlet-class> 
                 <load-on-startup>1</load-on-startup> 
         </servlet> 
  
         <servlet-mapping> 
                 <servlet-name>Prime Resource Servlet</servlet-name> 
                 <url-pattern>/primefaces_resource/*</url-pattern> 
         </servlet-mapping> 
 
	
	<servlet-mapping>
		<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>/faces/*</url-pattern>
	</servlet-mapping>
	
	<!-- Map all /spring requests to the Dispatcher Servlet for handling -->
	<servlet-mapping>
		<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
		<url-pattern>/spring/*</url-pattern>
	</servlet-mapping>
		

	<servlet-mapping>
		<servlet-name>ViewRendererServlet</servlet-name>
		<url-pattern>/WEB-INF/servlet/view</url-pattern>
	</servlet-mapping>
	
	
	<!-- Map all /resources requests to the Resource Servlet for handling -->
	<servlet-mapping>
		<servlet-name>Resources Servlet</servlet-name>
		<url-pattern>/resources/*</url-pattern>
	</servlet-mapping>
	
</web-app>
portlet.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"
			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
			xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
								http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
			id="somePortletID">

	<portlet>
		<portlet-name>xxxxxxxxxxxxx_Portlet286</portlet-name>
		<display-name xml:lang="de">xxxxxxxxxxxxxxxx_Portlet286</display-name>
		<display-name>xxxxxxxxxxxx_Portlet286</display-name>
		<portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
		<init-param>
			<name>wps.markup</name>
			<value>html</value>
		</init-param>

		<init-param>
			<name>contextClass [i]or[/i] contextConfigLocation</name>
			<value>
				xxxxxxxxxxxxxxxxxx.bootstrap.xxxxxxxxxxxxxxxxxxxxxPortletApplicationContext  or something like that
			</value>
		</init-param>

		<!-- Important for Prime Faces -->
		<init-param>
                <name>javax.portlet.faces.preserveActionParams</name>
                <value>true</value>
        </init-param>
        
         <init-param>
            <name>com.sun.faces.portlet.SAVE_REQUEST_SCOPE</name>
            <value>false</value>
        </init-param>   

		<init-param>
			<name>viewRendererUrl</name>
			<value>/WEB-INF/servlet/view</value>
		</init-param>
		<expiration-cache>0</expiration-cache>
		<supports>
			<mime-type>text/html</mime-type>
			<portlet-mode>view</portlet-mode>
			<portlet-mode>edit</portlet-mode>
            <portlet-mode>help</portlet-mode>
		</supports>
		<supported-locale>de</supported-locale>

		<portlet-info>
			<title>xxxxxxxxxx_Portlet286</title>
			<short-title>xxxxxxxxxxx_Portlet286</short-title>
			<keywords>xxxxxxxxxxxxxxx_Portlet286</keywords>
		</portlet-info>
	</portlet>


	<default-namespace>http://xxxxxxxxxxxxxxxxxx_Portlet286/</default-namespace>
</portlet-app>
faces-config.xml:

Code: Select all

<?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>

		<!-- Enable Facelets support -->
		<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
	</application>
	

</faces-config>
Hope that helps. Let me know.
Last edited by MikeSt on 18 Nov 2010, 16:38, edited 1 time in total.

hepi
Posts: 2
Joined: 12 Oct 2010, 13:09

03 Nov 2010, 11:13

Admittedly, I very quickly moved on to ICEfaces and now have a working application there.

Our long term goal of moving on to PrimeFaces, however, has not changed and I am very happy for your reply, which looks sensible.

I will evaluate as soon as time permits and respond more thoroughly.

Thank you very much..

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 29 guests