Skip to Content
Author's profile photo Mikhail Shipulin

How to set DOCTYPE on customized logon page EP 7.3, 7.4

After applying this instruction Customizing Logon Page on Portal 7.3 to customize logon screen you may need

to add specific doctype to logon page JSP or reset it’s head.

This post describes how to set DOCTYPE on customized logon page in SAP EP 7.3,7.4,

clear html head, remove html body class etc.

Step 1. You will need some classes (fig.1), provided by SAP team to manipulate html elements.

You can find class EnhancedPortalResponse in “com.sapconsulting.portal.utils.html_api.jar” file which is packaged in Ajax Framework sample code available for download from SDN Code Exchange ([Ajax Framework Sample code|https://cw.sdn.sap.com/cw/groups/sap-portal-ajax-framework?view=overview]).

To get this jar please register yourself at SDN Code Exchange Program. Once approved, you can request to join the Project – Ajax Framework and get the project files. However, you’d need an SVN client to download the files in NWDS.

For more info about this jar please, refer to 4.1.1 Create a Portal Application in this guide http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/001bfa1a-958e-2e10-c2be-d914f673e21e?overridelayout=t…

fig.1 Standart SAP classes for HTML manipulation.

Step 2. Assuming that you have that custom component, there is still a question, how to instantiate EnhancedPortalResponse object on portal logon

JSP in login web-module. My suggestion is to use reflection. You will need next imports on JSP (clsses that we have created in step1) (fig.2):

fig.2 Logon web-module JSP imports.


Step 3. Add custom code to logonPage.jsp as in example on fig.3


fig.3 Code to set doctype, reset head, add some html elements.


A brief description about what goes on fig 3:

On line 12 we get class of an object that wraps EP runtime ordinary servlet request.

If user enters portal by adress  like HOST:PORT/irj/portal the type of this wrapper object will will be

com.sap.portal.prt.util.PortalServletRequestWrapper, but if user enters direct link e.g. to nwa : HOST:PORT/nwa, this object will be of other type (in our case we dont deep-cudtomize HOST:PORT/nwa logon page, just show simple logon page for administrators without deep customization

so I will not describe how to get EnhancedPortalResponse in this situation)

Next on line 14 we get method of that wrapper object PortalServletRequestWrapper, make it accesible on 15 line, and invoke that method to recieve IPortalComponentRequest object.

Next on line 18 we invoke EnhancedPortalResponse constructor wich gets IPortalComponentRequest object as a parameter, and on lines 19-25 we are working with html head (resetting it, creating IE=edge meta tag, setDocTypeToXhtml10Transitional and even adding bootstrap.css).

Here you can find other examples of using EnhancedPortalResponse for html content manipulation http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/001bfa1a-958e-2e10-c2be-d914f673e21e?overridelayout=t…

Please, ask me in comments if you have questions about how to find SAP framework classes or what decompiler I used in this example etc.

Assigned Tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      I'm looking to make our logon page render in "edge" mode.  For irj/portal I implemented the DocumentHooksTagService which works for the logon page for the portal and nwa, but not for other java applications (the service doesn't get invoked).

      I'd like to try your method -

      Where did you find these classes on SAP AS? 

      Author's profile photo Mikhail Shipulin
      Mikhail Shipulin
      Blog Post Author

      Hi Chris,

      actually you can download these classes in "com.sapconsulting.portal.utils.html_api.jar file which is packaged in Ajax Framework sample code available for download from SDN Code Exchange ([Ajax Framework Sample code|https://cw.sdn.sap.com/cw/groups/sap-portal-ajax-framework?view=overview]).

      For more info about this jar please, refer to 4.1.1 Create a Portal Application in this guide http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/001bfa1a-958e-2e10-c2be-d914f673e21e?overridelayout=t…

      Author's profile photo Former Member
      Former Member

      Weird - when i click on the URL for cw.sdn.sap.com - i see "Unauthorized"

      Author's profile photo Mikhail Shipulin
      Mikhail Shipulin
      Blog Post Author

      Yep, think that it is old link and now it's broken. Did you try SVN resource from this guide?

      http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/001bfa1a-958e-2e10-c2be-d914f673e21e?overridelayout=t…

      Author's profile photo Former Member
      Former Member

      I've implemented the steps that you mention above. The problem I'm having is the package com.sapportals.portal.prt.* is not available in NWDS. I can package and deploy the EAR regardless of these errors but then I'm getting compiler errors in the portal when loading my logon page because the compiler cannot find the com.sapportals.portal.prt.* classes.

      If I include the jar for this package (prtapi.jar) in NWDS it will resolve the errors and my page will load, but then I'm getting a class cast error at line 16.

      java.lang.ClassCastException: Cannot cast class com.sap.portal.prt.component.PortalComponentRequest to

      interface com.sapportals.portal.prt.component.IPortalComponentRequest

      (found matching interface com.sapportals.portal.prt.component.IPortalComponentRequest loaded by

      library:tc~epbc~prtc~api@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@720ffab4@alive,

      but needed loader idexx.com/tc~sec~ume~logon~uiEAR@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@7786e410@alive)

      Any ideas?

      Thanks

      Author's profile photo Mikhail Shipulin
      Mikhail Shipulin
      Blog Post Author

      Hi Nick!

      Thanks for trying this short how to 🙂

      Please follow next steps:

           1.  create External Library DC and add to it's public part next jars (name this DC let us say portal/libs):

                    - com.sap.portal.navigation.afp.helperservice_api.jar

                     - com.sap.portal.navigation.afp.helperservice_core.jar

                     - com.sap.portal.pagebuilder_api.jar

                    - com.sap.portal.runtime.system.connection_api.jar

          2.  create DC with type Java, add decompiled classes (fig.1)to it, name it e.g.           html/utils

           3.  reference standart DC tc/epbc/prt/apps (you can find it in EP-BASIS SC), and           portal/libs from html/utils

           4.  reference portal/libs and html/utils from logon project, also add standart DC as dependencies to logon DC:

                    - tc/epbc/prt/api

                     - tc/epbc/prt/apps

                    - tc/epbc/prt/lib/api

      Please write back, I am curious wether It will help you or not 🙂

      Author's profile photo Durga Rao Vaddadi
      Durga Rao Vaddadi

      Hi Mikhail Shipulin,

      This document is shared good information.But i need this below jar.

      com.sapconsulting.portal.utils.html_api.jar ,Please tell me the jar file location.I checked in server unable to get the jar.Where i can get this jar.

      Author's profile photo Mikhail Shipulin
      Mikhail Shipulin
      Blog Post Author

      Hi Durga Rao Vaddadi

      Register yourself at SDN Code Exchange Program. Once approved, you can request to join the Project – Ajax Framework and get the project files. However, you’d need an SVN client to download the files in NWDS.

      Also I can send you this jar, here is my email sibilare@gmail.com