WebSphere Portal

WebSphere portal is a well managed website, which will allows users to maintain their company details online. Portal server is a IBM licensed products. It will provide a nice look and feel to the end user. Websphere portal server will aggregate content from different portlets and finally gives a complete website.

Real time portal projects examples as below.

https://www.idea.com

https://www.americannational.com

https://www.bsnl.com

What is Virtual Portal And What are the Steps for Creating a Virtual Portal

  • Virtual Portal:
  • Virtual Portal is nothing but copy of websphere Portal.All the things we can do here,what we are doing in websphere portals except deploying portlet into server.Because  webmodules tab is not available in virtual portal.

    If we create some pages in this virtual portal,that pages will be visible to that user only.

    A single portal installation can support up to 150 virtual portals.

  • Step1 :

    Steps for creating a Virtual Portal .

  • Below are the simple steps for creating a virtual portal:

1.Logon to Websphere portal server v6.1http://localhost:10039/wps/portal/

2.Navigate to Virtual Portals -> Mange Virtual Portals at the bottom of console.

3. Click New Virtual portal and fill out the following information and click OK.
vp1

vp2

Step 2:  To Fill the below 

Title :rpkl
Description : This is rpkl
URL Context : rpkl
Host name : The host name of the virtual portal. This attribute is optional.
User realm : Leave it default .
Initial admin user group : Click search button besides it and click search on the next screen
and select one you need or select the default one. (wpsadmins)
Default theme : Select the default or leave it to IBM.

vp6

Initial admin user group : Click search button besides it and click search on the next screen
and select one you need or select the default one. (wpsadmins) like below
vp5

Click on >ok.

Step 3:

Observe below Screen

vp7

Step 4:

Created Virtual portal shown below

vp8

Step 5: Search browser like below url

http://localhost:10040/wps/myportal/rpkl

  • vp9

JDBC Connection in WebSphere Application Server v6.1

Creating a JDBC Provider and DataSource in WebSphere Application Server v6.1

  • Creating and configuring a JDBC provider:

  • STEP 1;
  • Log on to the WebSphere Application Server Console(DMGR)

    Click  on Resources > JDBC > JDBC providers.> Select the Scope Node >WebSphere_Portal Like Below

img1

STEP 2:

And Then Click on >NEW >Select Database Type(like Oracle)And Implementation type(like Connection Pool data source)&>Name(eamcet1)Like below screen ;

img2

STEP 3:

Then Click on >NEXT>Copy the Oracle OJdbc path directory>Paste it Directory Location(like C://oraclexe//app//oracle//product//10.2.0//server//jdbc//lib//ojdbc14.jar) Like below

img3

STEP 4:

Then Click on >Next>Finish>Like below;

img4

STEP 5;
CLICK on >Save> like below;

img5

STEP 6:
And Edit Which you are created Preferece (click on like eamcet1) And Copy the ojdbc jars Paste into >Class path in General Properties (like path C://oraclexe//app//oracle//product//10.2.0//server//jdbc//lib//ojdbc14.jar) like below;

img6

STEP 7:

And Then >Apply >Click on >OK>And >Save like below

img7

Creating  a Data source:

STEP 8:

 Click Resources > JDBC > Data sources. In the right pane, select appropriate scope for the data source. ( . Like Same as for Provider scope (WebSphere_Portal).  like below

img8  

STEP 9:

 And then click on >New>And Enter >Datasource Name(like eamcet1) >and Jndi Name (like eamcet1)>And We can create a new j2c authentication alia like below.

img9

 STEP 10:

And Click  on >create a new j2c authentication alias like below

img10

STEP 11:

Then Click >New>Enter General Properties(like Alias:eamcet>UserId(SYSTEM)>password(Manager)(Userid and password same as Oracle database) like below

img11

STEP 12:

Then >Apply>OK>SAVE like below Screens:

img12

img13

STEP 13:

And Click on>Data Source>click >NEW>Enter DataSource Name and Jndi name>Select Node(like lenov/eamcet (created j2c)) like below

img14

STEP 14:

Then click  on >Next>Select>Select an existing jdbc provider(like eamcet1) like below

img15

STEP 15:

Click on > Next>Enter >URL(jdbc:oracle:thin:@localhost1521:XE>And Select DataStore helper Class Name(like Oracle 10g datastore helper)>Remove selected CMP> like below

img16

STEP 16:

Click on >Next like below

img17

STEP 17:

Click >Finish >And Save like below

img18

STEP 18:
When you are  created your preferences select (like eamcet1) then >click on  Test Connection and Observe the Successful message like below.

img19

=============================>END========================================

 

Spring Portlet Example

1 In this example , i am going to show Spring Portlet Example

2 Environment:

Portal Server v6.1 ,Rad v7.5

Step3:

File>New> Select PortletProject>Project name(like AjaxSpringPortlet)>Choose the Target Runtime Server(like WebSphere Portal v6.1) and Portlet Type(Basic Portlet) like below

image1

=>Click on Next >Next>Finish

Step 4: Project Structure like below

image2

Step 5:

Create the folder in WEB-INF (like folder name is  jsp) like below

image3

=>Click on > finish.

Step 6:

Then Select the jsp folder >Right click on > New>WebPage> Write the File Name like below

image4

Click on > Finish

MainView.jsp like below

image5

image6

Code MainView.jsp:

<%@page

language=“java” contentType=“text/html; charset=ISO-8859-1”

pageEncoding=“ISO-8859-1” session=“false”%>

<%@ taglib uri=http://java.sun.com/portlet_2_0&#8221; prefix=“portlet”%>

 

<%@taglib

uri=http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model&#8221;

prefix=“portlet-client-model”%>

<%@taglib uri=http://java.sun.com/portlet&#8221; prefix=“portletx”%>

<%@taglib uri=http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model&#8221; prefix=“portlet-client-model” %>

 

<portlet-client-model:init>

<portlet-client-model:require module=“ibm.portal.xml.*” />

<portlet-client-model:require module=“ibm.portal.portlet.*” />

</portlet-client-model:init>

<portlet:defineObjects />

<portlet:resourceURL var=“getDetailsURL” id=“getDetailsURL”></portlet:resourceURL>

http://em

<h1 style=“color: red”>Hello Welcome To MainView </h1>

 

<div ng-app=“myApp” ng-controller=“myController”>

Enter user name: <input ng-model=“userName”><br>

<input type=“button” value=“Submit” ng-click=“getData()”><br>

<h3>{{message}}</h3>

 

var app = angular.module(‘myApp’, []);

app.controller(‘myController’, function($scope, $http) {

$scope.getData= function ()

{

var userName=$scope.userName;

alert(“user name is : “+userName);

$http.get(”,{ params: {user:userName}})

.then(function(response) {

alert(response);

$scope.message = response.data;

});

}

});

Step 7:

Create the class:

Right click on the project under  src >select the >class> and write the class name (like AjaxController.java)  like below

image7

Click on> Finish

AjaxController.java like below

image8

Code: AjaxController.java

 

package com.anu.controllers;

 

import java.io.IOException;

 

import javax.portlet.ResourceRequest;

import javax.portlet.ResourceResponse;

 

import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.portlet.bind.annotation.RenderMapping;

import org.springframework.web.portlet.bind.annotation.ResourceMapping;

 

@Controller

@RequestMapping(“view”)

public class AjaxController {

@RenderMapping

public String showDefaultPage()

{

System.out.println(“inside showDefaultPage of AjaxController >>>> “);

String defautPage=”MainView”;

 

return defautPage;

}

 

@ResourceMapping(value =”getDetailsURL”)

public void getDetails(ResourceRequest req, ResourceResponse res) throws IOException

{

System.out.println(“inside getDetails >>>> AjaxSpring >>>  “);

String brideName=req.getParameter(“user”);

res.getWriter().write(“Hello Balu and “+brideName);

 

//String defautPage=”finalResults”;

 

//return defautPage;

System.out.println(“results sent >>>> “);

//return “Hello Welcome To New Angular Js World !!!!!”;

}

}

Step 8:

Create the (AjaxSpringPortlet-portlet.xml ) file like below

AjaxSpringPortlet-portlet.xml:

image9

Code: AjaxSpringPortlet-portlet.xml like below

<?xml version=“1.0” encoding=“UTF-8”?>

<beans xmlns=http://www.springframework.org/schema/beans&#8221;

xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance&#8221;

xmlns:p=http://www.springframework.org/schema/p&#8221;

xmlns:context=http://www.springframework.org/schema/context&#8221;

xsi:schemaLocation=http://www.springframework.org/schema/beans 

http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 

http://www.springframework.org/schema/context 

http://www.springframework.org/schema/context/spring-context-3.0.xsd&#8221;>

 

 

<bean id=“viewController” class=“com.anu.controllers.AjaxController”/>

 

<bean id=“portletModeHandlerMapping” class=“org.springframework.web.portlet.handler.PortletModeHandlerMapping”>

<property name=“defaultHandler” ref=“viewController”></property>

<property name=“portletModeMap”>

<map>

<entry key=“view”>

<ref bean=“viewController”/>

</entry>

</map>

</property>

</bean>

<bean id=“view” class=“org.springframework.web.servlet.view.InternalResourceViewResolver”>

<property name=“viewClass” value=“org.springframework.web.servlet.view.JstlView”/>

<property name=“prefix” value=“/WEB-INF/jsp/”/>

<property name=“suffix” value=“.jsp”/>

</bean>

 

</beans>

Step 10:

ApplicationContext.xml like below

image10

Code ApplicationContext.xml   like below

<?xml version=“1.0” encoding=“UTF-8”?>

<beans

xmlns=http://www.springframework.org/schema/beans&#8221;

xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance&#8221;

xmlns:p=http://www.springframework.org/schema/p&#8221;

xsi:schemaLocation=http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd&#8221;>

<!–<bean id=”view” class=”org.springframework.web.servlet.view.InternalResourceViewResolver”>

<property name=”viewClass” value=”org.springframework.web.servlet.view.JstlView”/>

<property name=”prefix” value=”/WEB-INF/jsp/”/>

<property name=”suffix” value=”.jsp“/>

</bean>

–>

</beans>

Step 11:

Web.xml like below

image11

Code: web.xml :

<?xml version=“1.0” encoding=“UTF-8”?>

<web-app id=“WebApp_ID” version=“2.4” xmlns=http://java.sun.com/xml/ns/j2ee&#8221; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance&#8221; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd&#8221;>

<display-name>AjaxSpringPortlet</display-name>

<servlet>

<servlet-name>ViewRendererServlet</servlet-name>

<servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>ViewRendererServlet</servlet-name>

<url-pattern>/WEB-INF/servlet/view</url-pattern>

</servlet-mapping>

<listener>

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

</listener>

</web-app>

Step 12:

portlet.xml like below

image12

Code: portlet.xml like below

<?xml version=“1.0” encoding=“UTF-8”?>

<portlet-app xmlns=http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd&#8221; version=“2.0” xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance&#8221; 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&#8221; id=“com.ibm.ajaxspringportlet.AjaxSpringPortlet.88f77076e5”>

<portlet>

<portlet-name>AjaxSpringPortlet</portlet-name>

<display-name xml:lang=“en”>AjaxSpringPortlet</display-name>

<display-name>AjaxSpringPortlet</display-name>

<portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>

<init-param>

<name>wps.markup</name>

<value>html</value>

</init-param>

<expiration-cache>0</expiration-cache>

<supports>

<mime-type>text/html</mime-type>

<portlet-mode>view</portlet-mode>

</supports>

<supported-locale>en</supported-locale>

<resource-bundle>com.ibm.ajaxspringportlet.nl.AjaxSpringPortletResource</resource-bundle>

<portlet-info>

<title>AjaxSpringPortlet</title>

<short-title>AjaxSpringPortlet</short-title>

<keywords>AjaxSpringPortlet</keywords>

</portlet-info>

</portlet>

<default-namespace>http://AjaxSpringPortlet/</default-namespace&gt;

</portlet-app>

Step 12:

Result: 

image13