css problem with portlets
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > WebSphere > WebSphere Portal Server > css problem with portlets




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    css problem with portlets  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-25-07 12:22 PM

Hi,

I have used following way to include css file in portlet pages.

<link href="<%= renderResponse.encodeURL(renderRequest.getContextPath()+"/cs
s/sb_styles.css")%>" rel="stylesheet" type="text/css">

But its not working. Is this any other way need to include css. pls help me.





[ Post a follow-up to this message ]



    Re: css problem with portlets  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-25-07 12:22 PM

You should use single quotes for encode url...

i.e.

<link href='<%= renderResponse.encodeURL(renderRequest.getContextPath()+"/cs
s/sb_styles.css")%>' rel="stylesheet" type="text/css">

Try this and let me know





[ Post a follow-up to this message ]



    Re: css problem with portlets  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-25-07 12:22 PM

I tried the same, but no use.





[ Post a follow-up to this message ]



    Re: css problem with portlets  
Michael Harris


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-25-07 06:23 PM

First note that your code will result in HTML that will not validate
since you have a <link> tag outside the <head> tag.  The proper way to
include CSS is to link the stylesheet in the <head> tag in the theme.

Having said this, most browsers will honor <link> outside the <head>
even though it is invalid so you should still be able to do this.

The code you posted looks correct assuming that your css file is located
at /css/sb_styles.css in your war.

First thing to do is be sure that the file is actually getting served
up.  Open your portlet, do a "view source" and search for your link tag.
Copy the URL out of the href attribute and paste it into the browser
address bar.  Add on the front of the URL the
http://yourservername:portname part before the /wps part you copied.  If
you get the CSS contents, then your file is serving correctly... but it
is either being ignored because of some other error on your page OR the
styles in it are not formatted correctly.  If you do not get the CSS
contents and get something like a 404 error, then you either have
explicitly turned off file serving in your portlet (which isn't likely)
or the file path is wrong somehow.  Can you serve images from your war
into <img> tags in your portlet?  The CSS url should be generated
exactly the same way.

Note:  You can't serve up images or CSS from underneath the WEB-INF
folder.  If the browser needs access to call and load the files directly
without going through the portlet, then the files must be outside WEB-INF.





[ Post a follow-up to this message ]



    Re: css problem with portlets  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-26-07 06:20 AM

I called my css file in head.jspf after that it worked fine. thanx for yr su
ggestion.





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:22 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register