Skip to Content
0
Former Member
Apr 06, 2011 at 04:07 PM

WPC -- Add external CSS to JSP for Custom WPC Page Layout

31 Views

Hi Experts:

I have read many of the threads to add a custom external CSS stylesheet to my jsp file for a WPC custom Page Layout; but, I still cannot get the styles to work.

All works fine except for the external CSS. So far, I have done the following.

1. Create custom page layout

2. Create jsp file and portalapp.xml for new portal app in NWDS

3. Create new CSS stylesheet under dist\css

4. Modify jsp file to incllude CSS stylesheet

5. Test the new layout in WPC.

My IE Developer Toolbar shows that my stylesheet is included at runtime

Here is my code to include my CSS file located in dist\css.

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

componentResponse.include(componentRequest, myCss);

%>

When I include my CSS class in a internal stylesheet, it works just fine. However, when I use the CSS class in an external CSS, the class is ignored. Again, I have verified that the stylesheet is included at runtime.

Has anyone experienced similar issues?

thanks in advance...