cancel
Showing results for 
Search instead for 
Did you mean: 

Adding External Style sheet

suresh_krishnamoorthy
Active Contributor
0 Kudos
189

Hi,

I am using JspDynPage.How to add CSS(Style Sheet) in my *.jsp file. For Internal CSS(Style sheet) it is working properly. For External CSS(Style sheet) Style sheet properties was not reflecting. Anything i have to add in portalapp.xml. whether i need to configure anything in portal? Is there any documentation available about External stylesheet.

This is the JSP code :

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

<Html>

<Head>

<%

IResource rs = componentRequest.getResource(IResource.CSS, "css//ex1.css");

String URL = rs.getResourceInformation().getURL(componentRequest);

%>

<link rel= "stylesheet"

type= "text/css"

href= "<%=URL%>"

/>

</Head>

<body>

<h1>This is header 1</h1>

<h2>This is header 2</h2>

<p>This is a paragraph</p>

</body>

</html>

Thanks & Regards

suresh kb

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Suresh,

Put your CSS under dist->css folder. If css folder is not there then create it and use the following line.

<b>

<link rel=stylesheet href="<%=webpath%>css/logon.css">

</b>

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi prakash,

hereby i attached the modified code, still it is not working. check whether the code is correct.

<Head>

<%

String CSSURL = componentRequest.getWebResourcePath();

%>

<link rel="stylesheet" type="text/css" href="<%=CSSURL%>css/ex1.css" />

</Head>

Thanks in advance.

Former Member
0 Kudos

are you getting any error. If you are then post the stack trace abd the error. You also are missing one "/".

cut and paste the following line.

<b><link rel="stylesheet" type="text/css" href="<%=CSSURL%>/css/ex1.css" /></b>

Message was edited by: Prakash Singh

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi prakash,

thanks a lot, hereby i attached the JSP code it is working properly for all except background color. whether anything i have to add more for background color.

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

<Html>

<Head>

<%

IResource rs = componentRequest.getResource(IResource.CSS, "css/ex1.css");

response.addResource(rs);

%>

</Head>

<body>

<h1>This is header 3</h1>

<h2>This is header 2</h2>

<p>This is a paragraph</p>

</body>

</html>

thanks