cancel
Showing results for 
Search instead for 
Did you mean: 

Apply a custom style sheet to the web pages.

Former Member
0 Kudos

I have created custom page layout by changing the jsp and xml files. Now I want to use a custom style sheet.

I have uploaded my custom style sheet at "etc/wpceditor/css/runtime/myfile.CSS"

I don't know how to test if my page layout is using this style sheet (myfile.css). ???

How should I link my custom page layout to this style sheet (myfile.css) ?

I have also tried to include the myfile.css in my project (par) changed the jsp file


<%@ 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 myfile = componentRequest.getResource(IResource.CSS, "css/myfile.css"); 
	componentResponse.include(componentRequest, myfile); %>

Can you tell me how to test if am using the style sheet myfile.css ?

Thanks

Srinivas

Accepted Solutions (1)

Accepted Solutions (1)

vishal_gupta15
Contributor
0 Kudos

Hi Srinivas,

The WPC by default refer the CSS file stored at etc/wpceditor/css/runtime/ .

And if u want to put the reference of CSS file in JSP(of the layout) then use following code

<LINK REL="stylesheet" HREF="irj/go/km/docs/etc/wpceditor/css/runtime/myFile.css" />

_Vishal

Answers (1)

Answers (1)

Former Member
0 Kudos

I think you can directly use your CSS in JSP page.

<link href="/styles/default.css" rel="stylesheet" type="text/css" />

No need to read it as resources. in Par file.

To test your CSS is working or not. Change background color or any other visible element in to black. and execute run your PAR application. If the background color changes that means your CSS is applied.

Former Member
0 Kudos

Hi Shrikant,

Thanks for your reply, I changed the jsp's like you mentioned. I haven't changed anything in css file, so I am not seeing any difference after I deployed the par. Now can you also point me in the css file where I can change the back ground color.

How does the code look like in css file that mentions the back ground color, or do I have to add this code in the css file if I don't have the mention for the back ground color.

Thanks

Srinivas

Former Member
0 Kudos

Hi Srinivas,

You need to do the following.

1. put the css file under

dist->css

folder. If

css

folder is not there then create it. the name of folder can be whatever css, style .. whatever you want.

2. In your jsp add the following code.

<% String css = componentRequest.getWebResourcePath() + "/css/loginStyle.css"; %>

<LINK REL="STYLESHEET" TYPE="text/css" HREF="<%=css%>">

for further changes to be done in your CSS to adjust the background color you can refer to the following thread -

[Background Color changes through CSS|;

Regards,

Shailesh

Former Member
0 Kudos

Thanks

Edited by: srinivas M on Feb 27, 2009 9:06 PM