• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

CSS problem

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have a CSS file defined inside my jsp file with the tag
<link rel="stylesheet" href="./css/global.css" type="text/css" /> i am able to view the preview on my desktop but when i deploy my ear file on the server,its not able to pick my css file . iam actually surprised with it.

Can anyone help me in this regard .

Thanks

krish
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See:
http://faq.javaranch.com/java/RelativeLinks

It may contain the solution to your problem.
 
krish chaitu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Its not able to pick the file itself now,i am not able to view it in the preview itself,

Can anyone please help me, iam doing lot of things but nothing is working out.

Thanks
krish

Originally posted by krish chaitu:
Hi

I have a CSS file defined inside my jsp file with the tag
<link rel="stylesheet" href="./css/global.css" type="text/css" /> i am able to view the preview on my desktop but when i deploy my ear file on the server,its not able to pick my css file . iam actually surprised with it.

Can anyone help me in this regard .

Thanks

krish

 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"The preview" means almost nothing to us.

Where is your JSP?
Where is your CSS file?
How are you accessing your JSP?... directly from a browser, or are you
forwarding from another resource, such as a controller servlet?

If you've changed the link since your first post, please post the new version.
[ December 06, 2007: Message edited by: Ben Souther ]
 
krish chaitu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

As mentioned in the link i have changed the link tag with the following & now its not displaying it in the preview itself.
<link rel="stylesheet" ref="${pageContext.request.contextPath/css/global.css}" type="text/css" />

This is not working at all.

Please help me

Thanks
krish

Originally posted by krish chaitu:
Hi

I have a CSS file defined inside my jsp file with the tag
<link rel="stylesheet" href="./css/global.css" type="text/css" /> i am able to view the preview on my desktop but when i deploy my ear file on the server,its not able to pick my css file . iam actually surprised with it.

Can anyone help me in this regard .

Thanks

krish

 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know what you're talking about when you say 'the preview'.
There is no such thing as a 'preview' in JSP.

If you're using a wysiwyg HTML editor that doesn't understand JSP, then I wouldn't expect it to be able to show the CSS sheet because it will have no idea how to interpret ${pageContext.request.contextPath}. If that's not what you mean then you'll have to start by explaining what 'the preview' means to you.
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why dont you get the css file using the getContextPath() method?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by pulijala hari:
why dont you get the css file using the getContextPath() method?



Did you read the JSP FAQ entry mentioned earlier in this thread?
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by krish chaitu:

<link rel="stylesheet" ref="${pageContext.request.contextPath/css/global.css}" type="text/css" />

Careless mistakes will shoot you down every time. Carefully check the syntax of your statement and be sure that you understand it before using it.
 
krish chaitu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Ihave went through the thread & also done the changes as mentioned in the thread but still not able to get past this error.if iam making any careless mistakes ,please let me know what mistake i have done.

Thanks
krish



Originally posted by Bear Bibeault:
Careless mistakes will shoot you down every time. Carefully check the syntax of your statement and be sure that you understand it before using it.

 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Consider your use of the EL. Are your braces, { and }, in the right places?
 
krish chaitu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My braces are at the right place.but not able to display the page.

Thanks
krish


Originally posted by Bear Bibeault:
Consider your use of the EL. Are your braces, { and }, in the right places?

 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by krish chaitu:
My braces are at the right place.

No, they are not.
 
krish chaitu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hii,

Here is how iam using, just tell me if it is wrong,what need to be done
<link rel="stylesheet" ref="${pageContext.request.contextPath}/css/global.css" type="text/css" />


Thanks
krish



Originally posted by Bear Bibeault:
No, they are not.

 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by krish chaitu:
Hii,

Here is how iam using, just tell me if it is wrong,what need to be done
<link rel="stylesheet" ref="${pageContext.request.contextPath}/css/global.css" type="text/css" />


Thanks
krish





This is not what you posted earlier.
See: http://faq.javaranch.com/java/AvoidRedHerrings
This now looks OK.
Which.. brings us back to my earlier question.
What are you using to view this JSP (what are you talking about when you say "PREVIEW')?
[ December 06, 2007: Message edited by: Ben Souther ]
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is not what you posted earlier.

If the css folder is at the root of your web app (in the same folder as WEB-INF), this will work.

You will be able to do a View Source from the browser to see the resulting URL, and then use that URL in the address bar to determine if the address is correct.
[ December 06, 2007: Message edited by: Bear Bibeault ]
 
krish chaitu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hii,


Thanks all for your help, it worked fine

Thank you very much.

Regards
krish


Originally posted by Ben Souther:


This is not what you posted earlier.
See: http://faq.javaranch.com/java/AvoidRedHerrings
This now looks OK.
Which.. brings us back to my earlier question.
What are you using to view this JSP (what are you talking about when you say "PREVIEW')?

[ December 06, 2007: Message edited by: Ben Souther ]

 
Curse your sudden but inevitable betrayal! And this tiny ad too!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic