You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by "Arne v.Irmer" <Ar...@udo.edu> on 2004/06/25 17:13:34 UTC

The use of CSS in portlets

In the JSR168 specification mentions css only in connection with OASIS Portlet 
css. 
But how do I defnie my own style sheets in my portlet?
The problem that we have here, is that we need a <head>-section to write our 
own stylsheet definition, but portlet don’t have a <head>-section. Defining 
styles in body works with mozilla and Ie, but is not html-compliant. 

My first (and working) solution is to add the style definition to the head.jsp
file in Pluto/WEB-INF/aggregation. If you want to have an external .css file you
have to remember that you have a strange relative path in the 
pluto-servlet area. 
The only solution to this problem is in my opinion to work with absolute paths.
This has the positive side effect that you can leave the css file for each
portlet in their domain. 
Example:
<!--Head-->
<HEAD>
    <TITLE>Protlet css-test</title>
    <link rel="StyleSheet" media=”screen” type="text/css"
href="/myportlet1/css/myCss.css">
    <link rel="StyleSheet" media=”screen” type="text/css"
href="/myportlet2/css/myCss.css">
</head>
This solution does have some flaws:
1. You have to define namespaces for style sheet class names so that you don’t
get in conflict with different portlet class names
2. Style sheets are always included. Even if the appropriate portlet isn’t
visible at that moment.

What I would recommend is to have css handling via a communication between the
portlet and pluto. The portlet should advise pluto to write anything in the
<head>-section. This could be a style sheet-definition or meta information 
about the content that is currently displayed in the portlet or something 
else. 

Does anyone has a good idea, to do this in a (more or less) JSR 168 compliant 
way?

Yours
 Arne v.Irmer

Arne{dot}vonIrmer{at}udo{dot}edu 



Re: The use of CSS in portlets

Posted by "Arne v.Irmer" <Ar...@udo.edu>.
> Hi.
> I understand your point but I think that a portlet should never define 
> his own stylesheet and just use the standard classes (or provide its own 
> classes if useful). I know you would like to make your portlet shows 
> itself the way you designed it, but look it from the portal point of 
> view. Maybe I want to show the portlet in a completely different way. It 
> has to be my responsability to customize the view.
> 

Ok, thats the way one should work with stylesheets in portlets:
1. Use styles defined in JSR168
2. If that is not enough use your own.

Am I wrong or doesn't pluto provide any stylesheets. Where can I get a JSR168
complient CSS-file?
  
Yours 
 Arne




Re: The use of CSS in portlets

Posted by David Barral <da...@elrincondelprogramador.com>.

Arne v.Irmer wrote:

> 
> What I would recommend is to have css handling via a communication between the
> portlet and pluto. The portlet should advise pluto to write anything in the
> <head>-section. This could be a style sheet-definition or meta information 
> about the content that is currently displayed in the portlet or something 
> else. 

Hi.
I understand your point but I think that a portlet should never define 
his own stylesheet and just use the standard classes (or provide its own 
classes if useful). I know you would like to make your portlet shows 
itself the way you designed it, but look it from the portal point of 
view. Maybe I want to show the portlet in a completely different way. It 
has to be my responsability to customize the view.


-- 
/**
  * David Barral
  * david@elrincondelprogramador.com
  */