cancel
Showing results for 
Search instead for 
Did you mean: 

Using customized css in a portal application

Former Member
0 Kudos

Hi,

Sorry for the beginner question but I can't find sufficient documentation for that.

I would like to use my own css in my portal component and override the default theme design, could someone please point me to what I should do ?

Thanks,

Elad.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi there,

In SAP Developer studio you can keep your CSS file at Project -> dist -> css folder.

Now you can add this css file in your project by writing

IResource jspResource = request.getResource(IResource.CSS, "css/GlobalReportStyles.css");

String URL = jspResource.getResourceInformation().getURL(request);

This URL can be used in your application to access the css file.

Regards,

Vishal

PS: Reward points if answer is helpful

Former Member
0 Kudos

Hi Vishal,

For some reson the solution you suggested didn't work, and my css doesn't affect the layout of my component.

Here is what I did:

In my jsp, after getting the URL of the css file according to your instructions,

I've added a <link rel="stylesheet" type="text/css" href="<%=resUrl%>" /> statement in the html's head section,

and for each element like a label or a textView I add the proper "class" attribute.

Is that correct ? Is that enough ?

What am I missing ?

Thanks,

Elad.

Former Member
0 Kudos

Hi Elad,

For JSPs to access this css file here is the sample code. Make sure that you keep your css file inside dist->css folder.

<Html>

<Head>

<%@ page import="com.sapportals.portal.prt.component.IPortalComponentResponse"%>

<%@ page import="com.sapportals.portal.prt.resource.IResource"%>

<%

IPortalComponentResponse componentResponse =

(IPortalComponentResponse)pageContext.getAttribute(javax.servlet.jsp.PageContext.RESPONSE);

IResource suckerfishCss = componentRequest.getResource(IResource.CSS, "css/GlobalReportStyles.css");

componentResponse.include(componentRequest, suckerfishCss);

%>

</Head>

<body>

</body>

</html>

Now the class files must be availble to you.

Regards,

Vishal