Pages

Saturday 14 April 2012

Linking css file defined in portlet /css file into JSP


Linking  css  file defined in portlet /css file into JSP .
 NOTE : Create a fileName.css  under CSS-folder or fileName.js  under Js folder of the portlet Context .
1.       Inside your init.jsp file ,include this line to get the context of the web application we are in .
<portlet:defineObjects />
<liferay-theme:defineObjects />

<%
    String ctxPath = request.getContextPath();
%>

2.   <%@include file="/jsps/init.jsp"%>

<link rel="stylesheet" href="<%=ctxPath %>/css/fileName.css" type="text/css" media="all" ></link>
<link rel="stylesheet" href="<%=ctxPath %>/js/fileName.js" type="text/css" media="all" ></link>

No comments:

Post a Comment