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.