- RAD 7.0.0.4 and above (7.0.0.7) Version
- Websphere Portal Server 6.0.0.2 Or Above
Creating a Portlet Application to Support the JSF Portlet
Switch to Web perspective to create the JSF Portlet Project
A portal Server has The following Roles
User --à only View Rights
Previledged User à Vew + Personalize (Only for Himself)
PortletPrefrences pref = getPrefrences();
Pref.setValue(); this will effect only for one instance for that specific user and not for anybody else
Editor -à View + Edit (for Everybody other that the one who has personalized) per instance of a portlet
PortletPrefrences pref = getPrefrences();
Pref.setValue(); this will effect only for one instance for all the user except those who have personalized
Manager à VIEW + EDIT + CONFIGURE
Changes done by a manager will affect all the users across all the instances of a portlet
PortletPrefrences pref = getPrefrences();
Pref.setValue(); this will effect all the instances of that portlet except those who have personalized or edited the same property
A Portlet has
View à The Default Mode Is a mode that makes portlet only visible
And the portlet contents can be made visible to only those who have user rights on the portlets
Edit à The Personalize Mode
The portlet gives you a personalize menu using this menu you can reach the portlet the applications PortletPreferences. If a user in Previleged user mode changes this preferences then the changes will affect only him any other instance or any other user this is instance specific personalization per user
Edit Defaults à
The portlet gives you a edit shared settings menu using this menu a user can change the PortletPreferences but this mode is visibile only to the Editors of the portlets and not for Users/Previledged Users
Config à
The Porlet gives a COnfig Button using which managers can change the portlet Specific Configuration that will affect across the instances and across the non personalized users for that property
Help à Is Just a display Screen Mode that is visible to everybody who even has user rights
If I enable 5 Modes the I will have 5 Faces Config.xml files
A individual portlet mode has a welcome file (IndexFile) this has to be configured in the portlet.xml by specifying the constant and file name
The portlet that you are using inturn extends the JSR168 Specification and encapsulates the FacesServlet
The Numbers of modes will result in number of faces-config.xml files
What Gets Generated ?
Five jsp (Faces Enabled Files Get Generated ) Reason you chose to use 5 Modes
But this also means that there will be 5 Backing Beans getting generated behind
5 + 1 (Abstact Helper for The JSF)
com.ibm.faces.portlet.FacesPortlet
Is provided by IBM
That internally Makes use of the FacesServlet àthat controls all the behavior
param>
param>
param>
param>
param>
The above init-param decide in which mode what page must be included when that mode is rendered
<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.ibm.faces.portlet.FacesPortlet.0ddc7401b1">
<portlet>
<portlet-name>FacesPortletportlet-name>
<portlet-class>
com.ibm.faces.portlet.FacesPortlet
portlet-class>
param>
param>
param>
param>
param>
param>
<portlet-mode>viewportlet-mode>
<portlet-mode>editportlet-mode>
<portlet-mode>helpportlet-mode>
<portlet-mode>configportlet-mode>
<portlet-mode>edit_defaultsportlet-mode>
customerjsfapp.nl.FacesPortletResource
<portlet-info>
portlet-info>
portlet>
<portlet-mode>configportlet-mode>
portlet-mode>
<portlet-mode>edit_defaultsportlet-mode>
portlet-mode>
portlet-app>
The Rest of the Setting go in the web.xml
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">
The location where state information is saved. Valid values
are 'server' (typically saved in HttpSession) and 'client'
(typically saved as a hidden field in the form. Default is
server.
<param-name>javax.faces.STATE_SAVING_METHODparam-name>
<param-value>serverparam-value>
param>
Comma-delimited list of context-relative resource paths
under which the JSF implementation will look for application
configuration resources, before loading a configuration
resource named /WEB-INF/facesconfig.xml (if such a resource
exists).
<param-name>javax.faces.CONFIG_FILESparam-name>
<param-value>param-value>
param>
The default suffix for extension-mapped resources that
contain JSF components. Default is '.jsp'.
<param-name>javax.faces.DEFAULT_SUFFIXparam-name>
<param-value>.jspparam-value>
param>
Monitors Faces JSP files for modifications and synchronizes
a running server with the changes without restarting the
server. If this parameter is set to false or removed from
the deployment descriptor, any changes made to Faces JSP
files may not be seen by the server until it is restarted.
This parameter is usually set to true while the Faces JSP
files are being developed and debugged in order to improve
the performance of the development environment.
<param-name>com.ibm.ws.jsf.JSP_UPDATE_CHECKparam-name>
<param-value>trueparam-value>
param>
Load JSF runtime when the application server starts up. If
this parameter is set to false or removed, JSF runtime will
be loaded and initialized when the first JSF request is
processed. This may disable custom JSF extensions, such as
factories defined in the project.
<param-name>
com.ibm.ws.jsf.LOAD_FACES_CONFIG_AT_STARTUP
param-name>
<param-value>trueparam-value>
param>
If set to true disables use of MultipartFacesContext,
allowing underlying implementations to be used.
MultipartFacesContext is required when the FileUpload
component is used, and can be disabled otherwise.
<param-name>
com.ibm.faces.DISABLE_JWL_MULTIPART_CONTEXT
param-name>
<param-value>falseparam-value>
param>
Value, in milliseconds, to be used for Expires header for
resources served by the JavaScript Resource Servlet. Default
is never (31536000000 milliseconds or 1 year).
<param-name>com.ibm.faces.RESOURCE_EXPIRE_MSparam-name>
<param-value>31536000000param-value>
param>
Defines the strictness of the conversion when converting
from a string to a date. The higher the value, the more
exactly the value must conform to the format. If 0
(liberal), all 'literals' are ignored while parsing a value,
mis-ordered components will be rearranged, any missing
component is supplied using the current datetime,
misspellings and incomplete spellings are allowed (to the
extent that they can be evaluated), 'E' and other non-unique
components are ignored. If 1 (strict), all 'literals' are
ignored while parsing a value, any missing component is
supplied using the current datetime, misspellings and
incomplete spellings are allowed (to the extent that they
can be evaluated), 'E' and other non-unique components are
ignored. For example if the pattern is MMMM dd, yyyy a user
can enter 'Feb/02/04' and it will be parsed as February 02,
2004. If 2 (very strict), an exact match is required except
long month names can be 'shortened' to the minimum number of
unique characters and 'E' and other non-unique components
are ignored. Literals must match exactly. Default is 1.
<param-name>
com.ibm.faces.DATETIME_ASSIST_STRICTNESS
param-name>
<param-value>1param-value>
param>
Defines the strictness of the conversion when converting
from a string to a number. The higher the value, the more
exactly the value must conform to the pattern. For numbers,
currently strictness levels of 0 and 1 are equivalent. If
the strictness is 2, if number is signed, the sign must be
provided (otherwise it's assumed positive). Default is 1.
<param-name>com.ibm.faces.NUMBER_ASSIST_STRICTNESSparam-name>
<param-value>1param-value>
param>
Defines the path for resources such as JavaScript libraries
and images. The value can be either: 1. An empty string.
Context path of the current application will be used. 2. A
path string. Example: /project13. A number. Specifies the
number of nodes to use from the context path starting from
the left. Example: With a value of 1 if the context path is
/screen/faces/SSID110267549/RID1102676 the path will be
evaluated as /screen Default is an empty string.
<param-name>
com.ibm.faces.USE_UNENCODED_CONTEXT_PATH
param-name>
<param-value>param-value>
param>
Sets a custom url-pattern for the JavaScript Resource
servlet. Should match servlet mapping setting for the
JavaScript Resource servlet. If the default default mapping
value '/.ibmjsfres/*' is modified, this context-param should
also be modified.
<param-name>
com.ibm.faces.JS_RESOURCE_SERVLET_URL_PATTERN
param-name>
<param-value>/.ibmjsfres/*param-value>
param>
If set to true, forces JavaScript Resource Servlet to cache
all resources on the server. This can be useful when
client-side caching is turned off.
<param-name>com.ibm.faces.JS_RESOURCE_SERVLET_CACHEparam-name>
<param-value>falseparam-value>
param>
Sets a custom charset mapping properties file similar to
converter.properties in WAS.
<param-name>com.ibm.faces.ENCODING_MAPPINGparam-name>
<param-value>converter.propertiesparam-value>
param>
Number of Views to be stored in the session when Enhanced
State Saving is being used. Default is 15.
<param-name>
com.ibm.faces.ENHANCED_SERVER_STATE_SAVING_SESSION_STORED_VIEWS
param-name>
<param-value>15param-value>
param>
If set to true, the entire JavaScript library, containing
code for all components, will be included in the generated
pages as one file. If set to false or removed, multiple
smaller JavaScript files will be included, depending on the
components used on the page.Default is false.
<param-name>com.ibm.faces.USE_HXCLIENT_FULLparam-name>
<param-value>falseparam-value>
param>
If false, client data will not be encoded, allowing multiple
portlets on a page to share the same client data model. By
default, client data will be encoded, so any value other
than "false", or the absence of the parameter,
will result in client data being encoded. This also affects
using Page Data with the Chart or Data Tree. By default Page
Data is encoded. Setting this value to "false"
will also unencode any Page Data that is being used with
either a Chart or a Data Tree.
<param-name>com.ibm.faces.ENCODE_DATAparam-name>
<param-value>trueparam-value>
param>
When using
(versions 5.1.0.3 onwards), this value must be set to true.
<param-name>
com.ibm.faces.TURN_OFF_AJAX_PORTAL_60_PATH
param-name>
<param-value>trueparam-value>
param>
com.sun.faces.config.ConfigureListener
<servlet id="Servlet_1215748867093">
<servlet-name>JavaScript Resource Servletservlet-name>
<servlet-class>
com.ibm.faces.webapp.JSResourceServlet
servlet-class>
servlet>
<servlet-mapping>
<servlet-name>JavaScript Resource Servletservlet-name>
<url-pattern>/.ibmjsfres/*url-pattern>
servlet-mapping>
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/portlet
<taglib-location>
/WEB-INF/tld/std-portlet.tld
taglib-location>
taglib>
jsp-config>
The Other Settings
The Deployement in RAD for Testing the war files in Portal Server TestEnvironment Requires you to Set the class Loader Policy of your war and Ear to PARENT_LAST (this is required only in RAD) in real time you export war files and the policy is set by the Deployment Script
Because you don’t deploy ear files on the actual portal server you deploy only war files on the actual portal hence this setting is required by us only in the RAD Environment ment
Where is the Setting ?
You have to open you application.xml
You have a EAR Project always attached to your Web Project mean
On RAD Testing Environment you cannot add war (WebProjects) to servers hence every war that you create creates ear (Enterprise Application Project) in that Project you have you Enterprise Application Deployment Descriptor (application.xml)
On the Deployment Tab
For you War you must choose as PARENT_LAST
If you don’t set this then
Some UI components that you place in the portlet will result in display
Unavailable/or links will point wrongly to pages that have no portlet url but a JSF Basic URL
AJAX Fails to Work for most Scenarios
RequestLinks Do not Produce Correct Links for Portal Server and create Basic JSF Links
I Have my Development Environment Ready for Development.
0 comments:
Post a Comment