You are on page 1of 15

1. What is the WebSphere portal?

Portal is the java based web application. It provides


single sign on and content aggregation and
personalization.
2. What is single sign on?
By using one authentication and authorization we can
access multiple applications no need to give the multiple
times of authentications for each applications.
3. What is content aggregation?
One application aggregate with multiple content
resources this is called content aggregation.
4. What is personalization?
Personalization means customized user related data.
5. What is portlet?
Portlet is a java web based component, it process the
request and generates static and dynamic content.
Content is generated by portlet is called html fragments.
Portlets are running at server side, portlet is a pluggable
user interface,
6. Portlet lifecycle?
During startup method instantiate process will be started,
after instantiation whenever first request comes from
client to portlet that time initialization process will be
start and after initialization portlet container will call
init() method in init() method portlet config object will be

created. Its a unique object in this we can perform highly


expensive operations like DB connections, network and
Ldap connections.
Note:
If we are getting any exception in the init()method, then
the Portlet lifecycle goes to sleep mode.
After instantiated we have 2 phases:
1. Render phase
2. Action phase
Render phase: its nothing but every time getting
refreshed content data
Action phase: whenever action performs portlet
container implicitly calls processAction() method in this
processAction() method we can perform business
operations after executing business operations portlet
container automatically called render phase.
Whenever we un-deploy the portlet automatically
destroy method will be called.
Modes:
Portlet have 4 modes:
1. doView(RenderRequest req, RenderResponse res)
In this mode only we can view the data, but we
cant modify
2. doEdit(RenderRequest req, RenderResponse res)
In this mode we can modify the data.

3. doHelp(RenderRequest req,RenderResponse res)


In this mode we can know about portlet information.

4. doConfig(RenderRequest req,RenderResponse res)


In this mode we can modify Admin related
information.
7. Custom portlet?
Those which we are creating new portlets those are
called custom portlets.
8. Out of box portlet?
IBM people provided inbuilt portlets those are called
out of box
portlets.
8. How to map server to rad?
Right click on console and add servers
9. How to create portlets?
Rigtclick on workspace----next---others-portletproject----next---give the project name---jsr168 1.0Basicportlet----next---finish

<portlet:actionUrl></portlet:actionUrl>------to call
process action
<portlet:renderurl></portlet:renderurl>----to call render
phase

<portlet:namespace>-----to identify the particular portlet


<portlet:actionUrl><portlet:param name= param
value=></portlet:actionUrl>- it is used for pass the
constant values.
<portlet:defineobject/>--------it is used for importing
implicit objects like renderRequest, renderResponse,
actionRequest, actionResponse etc.
11. How to create page?
Goto adminportaluserinterface---click on content root--newpage---title=mupage----uniqname=?---Friendlyurl=?,----theme=portal8.0----themestyle=?,----type of the page=standard portal layout,-----ok

After creating a page we can search and also we can


activate and deactivate that particular page.
12. how to plugin the portlet to particular page?
---click on Adminstratin----portaluserinterface----addportlets----ok
Again go to edit of the page and goto appreances-----skin
portalstandard----done

13. what is skin ?


Title bar of the portlet
14.what are the states of portlet?
1.Maximaze

2.min
3.normal
14.what is portletsession and describe?
Portlet session is interface .it will hold the data for
particular interval of time.
We have two 2 scopes:
1.applicatin scope
2.portlet scope
15.how to create portlet session?
Portletsession session=req.getPortletSession()
---default scope of portlet is:PortletScope
16.how to create seession and how to set values to
session?
In processAction()
If(req.getparameter(Form_submit!=null)
{
portletSession session=req.portletSession();
session.setAttribute(key,req.getparameter(FORM_TEXT)
,portletSession.Application_Scope());
}

17.how to get portlet session in jsp page?

<
%=renderRequest.getportletSession().getAttribute(key,
portletSession.Application_Scope%>
Websphere application server jndi connection:
Right click on the server----administration-runadminstrativeconsole
Websphere Application server:
https://localhost:10032\bin\ibm\console\logon.jsp
userID:wpsadmin
password:wpsadmin

How to create a jndi connection in websphere


application server?
After userid and password
Go to resources
Jdbc
Jdbc provider
All scope:webshere_portal

New
Database type:oracle
Provide type:oraclejdbcdriver
Implementation type:data source

Description:
Next
Next
Finsih
Save
Oracle jdbc driver
Classpath:
Apply
Save
Oracle jdbc driver
Jndi nam:oracle\anr
Next
Next
Enter database specific properties for the datasource:
Name:
url:
next
Global j2c authentication alias security domains:
New
Alias:
Userid:
Password:

Apply
Ok
Save
Open the data source:
Portlet preferences:
Portlet preferences are user registered data
---it will stored the database
----the table name:portlet_preferences
---portletpreferences we can achieve in 2 ways:
1.static way
2.dynamic way
Ipc(interportlet communication):
Using the property broker service we can achieve the ipc.
We have the 2 types.
1. Simple
2. Complex
-----in simple type (string type data is nothing but simple:
one portlet to another portlet)
-----in complex type (we are sending the data through the
object from one portlet to another is called complex. That
object should be serializable)
---create portlet poject(uncheck)---ipcportlet

--after creating ipc porlet project


----create source portlet and target porlet
---after source and target enable source portlet with send
----then target portlet enable with portlet with receive
----when ever enable the two portlets automatically wsdl
source and wsdl targert will be create.
----to format wsdl files we need to do
ctrl+shift+f,ctrl+a,ctrl+s.
----in wsdl file we need to remember the
action_param_nam and output property
----go to source portelt.java and initial the constant
variable
Like output_property=outputprperty.
----and go to source view.jsp and create portleturl like
portletURL portlet=renderResponse.createActionURL();
Portlet.setParameter(ACTION_NAME_PARAM,sourceActi
on);
In form action=<%=portlet.tostring()%>

How to create dynacache :


Right click on the server-----Administration--Runadministratin---Resources----CacheInstances---object
Cache instances.
Select scope:websphere_portal

New---name:dynacache
Jndi name:dynacache/jndi
---default dynamic
2000
Defaultpriority1
--dependency id
Apply---save
QUICK LINKS:
We have 2 urls:
1)Friendly url: by using friendly url we can access pages
and child pages and subchild pages
2)url mapping:by using url mapping we can directly
access any page

url mapping creation:


go to administration tab
--portal settings
---url mappings
---create new content
--label: anr
--ok

---after that have to select the edit mapping button and


search the page
---select radio button, ok
----then we can access the custom url or url mapping

Code of quick links:


<a href=/wps/myportal/anr>ipc</a>
How to create users and groups:

Ipc 286 Event Browker service by sending string


parameter from sorce portlet to target portlet and reverse
sending parameter from target portlet to source portlet:

1)it s a feature of jsr 286


2)By using Event Browker service we can achieve ipc in
jsr 286
3)we have two types:
simple type=string type data
--complex---object type data (object should be
serializable)
How to create ipc 286 by Event browker service:
1)create empty project after that create two different
portlets like source portlet and target portlet

2)we have to open portlet.xml


3) in portlet.xml we have to write below code witing
</portlet>
<portlet-name>ipcjsr286evntbrwstrng</portlet-name>
Write after </portlet-info>
<supported-processing-event>
<name>nag</name>
</supported-processing-event>
<supported-publishing-event>
<name>id</name>
</supported-publishing-event>
<portlet-name>ipcjsr286evntbrwstrng2</portlet-name>
Write after </portlet-info>
<supported-processing-event>
<name>id</name>
</supported-processing-event>

Write this code globally:


<default-namespace>http://ipcjsr286evntbrwstrng/</default-namespace>
<event-definition>
<name>id</name>
<value-type>java.lang.String</value-type>
</event-definition>

<event-definition>
<name>nag</name>
<value-type>java.lang.String</value-type>
</event-definition>
</portlet-app>

After this code complete do wiring above code flow:


Flow of string sending from string2portletview.jsp to
stringportlet.java to stringportletview.jsp(display)

1)string2view.jsp

<%@page session="false" contentType="text/html" pageEncoding="ISO-8859-1"


import="java.util.*,javax.portlet.*,com.ibm.ipcjsr286evntbrwstrng.*" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-clientmodel" prefix="portlet-client-model" %>
<portlet:defineObjects/>
<%=renderRequest.getParameter("id") %>
<FORM method="POST" action="<portlet:actionURL/>">
<LABEL for="<
%=com.ibm.ipcjsr286evntbrwstrng.Ipcjsr286evntbrwstrng2Portlet.FORM_TEXT%>">Enter
Order id:</LABEL><BR>
<INPUT name="<
%=com.ibm.ipcjsr286evntbrwstrng.Ipcjsr286evntbrwstrng2Portlet.FORM_TEXT%>"
type="text"/>
<INPUT name="<
%=com.ibm.ipcjsr286evntbrwstrng.Ipcjsr286evntbrwstrng2Portlet.FORM_SUBMIT%>"
type="submit" value="Submit"/>
</FORM>

2)stringportlet.java
public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, java.io.IOException {
if( request.getParameter(FORM_SUBMIT) != null ) {
response.setEvent("id", request.getParameter(FORM_TEXT));

}
@Override
public void processEvent(EventRequest request, EventResponse response)
throws PortletException, IOException {
Event evnt=request.getEvent();
String str=(String)evnt.getValue();
response.setRenderParameter("nag",str);

3)stringportletview.jsp:
<%@page session="false" contentType="text/html" pageEncoding="ISO-8859-1"
import="java.util.*,javax.portlet.*,com.ibm.ipcjsr286evntbrwstrng.*" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-clientmodel" prefix="portlet-client-model" %>
<portlet:defineObjects/>
<%=renderRequest.getParameter("nag")%>
<FORM method="POST" action="<portlet:actionURL/>">

<LABEL for="<
%=com.ibm.ipcjsr286evntbrwstrng.Ipcjsr286evntbrwstrngPortlet.FORM_TEXT%>">Enter
Order id:</LABEL><BR>
<INPUT name="<
%=com.ibm.ipcjsr286evntbrwstrng.Ipcjsr286evntbrwstrngPortlet.FORM_TEXT%>"
type="text"/>
<INPUT name="<
%=com.ibm.ipcjsr286evntbrwstrng.Ipcjsr286evntbrwstrngPortlet.FORM_SUBMIT%>"
type="submit" value="Submit"/>
</FORM>

After code do the wiring :


Flow of sending string value from stringporletview.jsp to
string2portlet.java to string2portletview.jsp(display)
1)stringportletview.jsp
<%@page session="false" contentType="text/html" pageEncoding="ISO-8859-1"
import="java.util.*,javax.portlet.*,com.ibm.ipcjsr286evntbrwstrng.*" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-clientmodel" prefix="portlet-client-model" %>
<portlet:defineObjects/>
<%=renderRequest.getParameter("nag")%>
<FORM method="POST" action="<portlet:actionURL/>">
<LABEL for="<
%=com.ibm.ipcjsr286evntbrwstrng.Ipcjsr286evntbrwstrngPortlet.FORM_TEXT%>">Enter
Order id:</LABEL><BR>
<INPUT name="<
%=com.ibm.ipcjsr286evntbrwstrng.Ipcjsr286evntbrwstrngPortlet.FORM_TEXT%>"
type="text"/>
<INPUT name="<
%=com.ibm.ipcjsr286evntbrwstrng.Ipcjsr286evntbrwstrngPortlet.FORM_SUBMIT%>"
type="submit" value="Submit"/>
</FORM>

2)string2portlet.java
public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, java.io.IOException {
if( request.getParameter(FORM_SUBMIT) != null ) {
// Set form text in the session bean
Ipcjsr286evntbrwstrng2PortletSessionBean sessionBean =
getSessionBean(request);
if( sessionBean != null )
sessionBean.setFormText(request.getParameter(FORM_TEXT));
}

}
@Override
public void processEvent(EventRequest request, EventResponse response)
throws PortletException, IOException {
Event event=request.getEvent();
System.out.println("**********"+event.getName());
String tvalue=(String)event.getValue();
System.out.println("**********"+tvalue);
response.setRenderParameter("id",tvalue);

3)string2portletview.jsp:
<%@page session="false" contentType="text/html" pageEncoding="ISO-8859-1"
import="java.util.*,javax.portlet.*,com.ibm.ipcjsr286evntbrwstrng.*" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-clientmodel" prefix="portlet-client-model" %>
<portlet:defineObjects/>
<%=renderRequest.getParameter("id") %>
<FORM method="POST" action="<portlet:actionURL/>">
<LABEL for="<
%=com.ibm.ipcjsr286evntbrwstrng.Ipcjsr286evntbrwstrng2Portlet.FORM_TEXT%>">Enter
Order id:</LABEL><BR>
<INPUT name="<
%=com.ibm.ipcjsr286evntbrwstrng.Ipcjsr286evntbrwstrng2Portlet.FORM_TEXT%>"
type="text"/>
<INPUT name="<
%=com.ibm.ipcjsr286evntbrwstrng.Ipcjsr286evntbrwstrng2Portlet.FORM_SUBMIT%>"
type="submit" value="Submit"/>
</FORM>

After code do the wiring:

You might also like