Displaying Message in Both Pre and Post Portal Login

15
8/10/2019 Displaying Message in Both Pre and Post Portal Login http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 1/15  SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 1 Displaying Message in both Pre and Post Portal Login Applies to: SAP Enterprise Portal. For more information, visit the Portal and Collaboration homepage. Summary This article will show you the step by step procedure of displaying message to the user who will login to portal. Generally the message can be displayed in two ways. One is before the initial login and the other after login. Both the scenarios have been considered and documented in this article. Author: Md Ansar Hussain Company: Mahindra Satyam Created on: 16 September 2009 Author Bio Md Ansar Hussain is working as a SAP Technical Consultant with Mahindra Satyam. Skill set includes SAP Enterprise Portal and Java/J2EE.

Transcript of Displaying Message in Both Pre and Post Portal Login

Page 1: Displaying Message in Both Pre and Post Portal Login

8/10/2019 Displaying Message in Both Pre and Post Portal Login

http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 1/15

 

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 1

Displaying Message in both Preand Post Portal Login

Applies to:

SAP Enterprise Portal. For more information, visit the Portal and Collaboration homepage. 

Summary

This article will show you the step by step procedure of displaying message to the user who will login toportal. Generally the message can be displayed in two ways. One is before the initial login and the other afterlogin.

Both the scenarios have been considered and documented in this article.

Author:  Md Ansar Hussain

Company:  Mahindra Satyam

Created on: 16 September 2009

Author Bio

Md Ansar Hussain is working as a SAP Technical Consultant with Mahindra Satyam.

Skill set includes SAP Enterprise Portal and Java/J2EE.

Page 2: Displaying Message in Both Pre and Post Portal Login

8/10/2019 Displaying Message in Both Pre and Post Portal Login

http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 2/15

  Displaying Message in both Pre and Post Portal Login

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 2

Table of Contents

Displaying Message to User ............................................................................................................................... 3 

Pre Login Scenario .......................................................................................................................................... 3 

Create a Project Using the par in NWDS ..................................................................................................................... 3 

Output .......................................................................................................................................................................... 9 

Post Login Scenario ...................................................................................................................................... 10 

Create a Project Using the par in NWDS ................................................................................................................... 10 

Output: ....................................................................................................................................................................... 12 

Related Content ................................................................................................................................................ 14 

Disclaimer and Liability Notice .......................................................................................................................... 15 

Page 3: Displaying Message in Both Pre and Post Portal Login

8/10/2019 Displaying Message in Both Pre and Post Portal Login

http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 3/15

  Displaying Message in both Pre and Post Portal Login

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 3

Displaying Message to User

Many the times, we get a requirement of displaying some static message to the user as a support activity.

The message can be displayed as both pre login and post login. Let’s see both the scenarios.  

Pre Login Scenario

 As the message is to be displayed before the login screen is shown, we need the logon par which is used asthe login module in the portal.

The com.sap.portal.runtime.logon.par  is the login module which is used as the logon screen in the portal.

We need to modify this par file to achieve this pre login scenario.

This par file can be obtained in System Administration tab in portal. To obtain this par file, navigate as below:

System Administrator > Support > Portal Runtime > Browse Deployment

Root > WEB-INF > deployment > pcd > search for com.sap.portal.runtime.logon.par  file and download it.

Note: To get this par file, we need to have the System Administration role.

The downloaded par file contains the code to modify as per our requirement and save it as logon.par.

Create a Project Using the par in NWDS

The downloaded logon.par file is used to create the project in NWDS. Click on the par button as shown in thefigure to upload the par file.

Figure 1: Import the par file

Page 4: Displaying Message in Both Pre and Post Portal Login

8/10/2019 Displaying Message in Both Pre and Post Portal Login

http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 4/15

  Displaying Message in both Pre and Post Portal Login

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 4

Let the project is named as PreLogon.

Figure 2: Create the project in NWDS

The umLogonPage.jsp is the initial page which is called whenever the portal link is opened. So we needchange the code in this page.

We need create a temporary JSP file in which the original code of umLogonPage is saved.

For instance we will create a JSP file called umLogonPage_temp.jsp and copy the original code ofumLogonPage.jsp to this.

Page 5: Displaying Message in Both Pre and Post Portal Login

8/10/2019 Displaying Message in Both Pre and Post Portal Login

http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 5/15

  Displaying Message in both Pre and Post Portal Login

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 5

To create the new jsp page, follow the below steps,

Right click on Portal-INF folder -> new -> other . As shown in the below screen shot.

Figure 3: To create the new JSP file.

Page 6: Displaying Message in Both Pre and Post Portal Login

8/10/2019 Displaying Message in Both Pre and Post Portal Login

http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 6/15

  Displaying Message in both Pre and Post Portal Login

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 6

Figure 4: Select File and click next

Page 7: Displaying Message in Both Pre and Post Portal Login

8/10/2019 Displaying Message in Both Pre and Post Portal Login

http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 7/15

  Displaying Message in both Pre and Post Portal Login

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 7

Figure 5: Name the file

Name the JSP file as umLogonPage_temp.jsp, and create a new JSP page.

Copy the original code of umLogonPage.jsp to umLogonPage_temp.jsp.

Page 8: Displaying Message in Both Pre and Post Portal Login

8/10/2019 Displaying Message in Both Pre and Post Portal Login

http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 8/15

  Displaying Message in both Pre and Post Portal Login

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 8

 As the portal initiates with umLogonPage.jsp, we will put the code which displays the static text as themessage for the user. Find the below code.

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Welcome to Portal</title>

</head>

<body>

<h4>

Welcome

</h4>

<center>

The text which you want to display...

<form name="test" action="/irj/portal">

<input type="submit" value="Go"/>

</form>

</center>

</body>

</html>

By using this code we can display the required text and can redirect the Logon Page once user clicks Gobutton.

Deploy the code by exporting the par file to the portal server and run it.

Figure 6: Click on export par file to deploy the par

Page 9: Displaying Message in Both Pre and Post Portal Login

8/10/2019 Displaying Message in Both Pre and Post Portal Login

http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 9/15

  Displaying Message in both Pre and Post Portal Login

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 9

Output

Figure 7: Message screen

Once the user clicks on Go button, it will show the logon page.

Figure 8: Shows the logon page

Page 10: Displaying Message in Both Pre and Post Portal Login

8/10/2019 Displaying Message in Both Pre and Post Portal Login

http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 10/15

  Displaying Message in both Pre and Post Portal Login

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 10

Post Login Scenario

 As the message is to be displayed after the user logs in, we need the portal masthead par. Thecom.portal.navigation.masthead.par  is the module which the portal takes the user once he/she logs in.

We need to modify this par file to achieve the post login scenario.

This par file can be obtained in System Administration tab in portal. To obtain this par file, navigate as below:

System Administrator > Support > Portal Runtime > Browse Deployment

Root > WEB-INF > deployment > pcd > search for com.portal.navigation.masthead.par  file and download it.

Note: To get this par file, we need to have the System Administration role.

The downloaded par file contains the code to modify as per our requirement and save it as logon.par.

Create a Project Using the par in NWDS

The creation of new project is similar as to that which mentioned in the above pre login scenario.

Let the project is named as PostLogon. 

Figure 9: Create the project

The HeaderiView.jsp is the initial page which is called whenever the user is logged into the portal. So weneed change the code in this page.

We need create a temporary jsp in which the original code of HeaderiView.jsp is saved.

For instance we will create a jsp file called HeaderiView_temp.jsp and copy the original code ofHeaderiView.jsp to this.

To create the new jsp page, follow the below steps,

Page 11: Displaying Message in Both Pre and Post Portal Login

8/10/2019 Displaying Message in Both Pre and Post Portal Login

http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 11/15

  Displaying Message in both Pre and Post Portal Login

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 11

Right click on Portal-INF folder -> new -> other . As shown in the below screen shot.

Figure 10: Name the temp jsp as HeaderiView_temp.jsp

 As the home page of portal initiates with HeaderiView.jsp, we will put the code which displays the static textas the message for the user into this page. Find the below code.

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Welcome to Portal</title>

</head>

<body>

<h4>

Welcome

</h4>

<center>

The text which you want to display...

<form name="test" action="/irj/portal">

<input type="submit" value="Go"/>

</form>

</center>

</body>

</html>

Page 12: Displaying Message in Both Pre and Post Portal Login

8/10/2019 Displaying Message in Both Pre and Post Portal Login

http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 12/15

  Displaying Message in both Pre and Post Portal Login

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 12

To run this code we need to com.sap.portal.navigation.masthead_core.jar  and htmlb.jar  files into the classpath of the project and copy these files in the lib folder under PostLogon\dist\PORTAL-INF\lib path of theproject as shown in the below screen shot.

Figure 11: Adding jar files

By using this code we can display the required text and can redirect the original home page once user clicksGo button.

Deploy the code by exporting the par file to the portal server and run it.

Output:

Figure 12: Welcome message.

Page 13: Displaying Message in Both Pre and Post Portal Login

8/10/2019 Displaying Message in Both Pre and Post Portal Login

http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 13/15

  Displaying Message in both Pre and Post Portal Login

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 13

Once the user clicks on Go button, it will show the home page of the user.

Figure 13: Home page of the user

Page 15: Displaying Message in Both Pre and Post Portal Login

8/10/2019 Displaying Message in Both Pre and Post Portal Login

http://slidepdf.com/reader/full/displaying-message-in-both-pre-and-post-portal-login 15/15

  Displaying Message in both Pre and Post Portal Login

SAP COMMUNITY NETWORK SDN sdn sap com | BPX bpx sap com | BOC boc sap com

Disclaimer and Liability Notice

This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is notsupported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.

SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document,and anyone using these methods does so at his/her own risk.

SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article orcode sample, including any liability resulting from incompatibility between the content within this document and the materials andservices offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of thisdocument.