JSP/Java and HTML have slightly different relative paths because of how 
they handle the context root.  For example, when you specify a "/" at the 
beginning of a link in HTML, that is taking you to the root of your web 
site so in order for your browser to get to your CSS, the Context-root 
would also need to be specified in the link.  In other words, it would 
look like this:

<LINK rel="stylesheet" href="/CONTEXT-ROOT/include/Styles/MyCss.css" 
type="text/css">

or if using relative links, which is obviously better:

<LINK rel="stylesheet" href="../../include/Styles/MyCss.css"
type="text/css">

However, when doing the linking in JSP, such as <%@ include %> or 
<jsp:include> the context root is implied and you do not specify it in the 
link, in fact you cannot.

So it really should depend on where you are doing the linking from. 
Finally, in some cases I think the validators are just wrong, and if it 
works at runtime all you can do is ignore the errors in your Tasks list.

Mark






"Joe Pluta" <joepluta@xxxxxxxxxxxxxxxxx> 
Sent by: wdsci-l-bounces@xxxxxxxxxxxx
01/02/2004 02:35 PM
Please respond to
Websphere Development Studio Client for iSeries <wdsci-l@xxxxxxxxxxxx>


To
"'Websphere Development Studio Client for iSeries'" <wdsci-l@xxxxxxxxxxxx>
cc

Subject
[WDSCI-L] CSS Links flagged as errors.






This one is an annoyance, but getting to be a bothersome one.

Let's say that in Web Content I have a folder "MyApp" and under that one
called "Version1", and inside that a JSP called "MyJSP.jsp".  For my
common stuff, I have a folder "include" under Web Content, and a folder
"Styles" under that, and a file "MyCss.css" in that folder.

So I add the following line to MyJsp.jsp:

<LINK rel="stylesheet" href="/include/Styles/MyCss.css" type="text/css">

This gets flagged with a broken link error.  If I drag and drop the CSS,
I get the following:

<LINK rel="stylesheet" href="../../include/Styles/MyCss.css"
type="text/css">

Which I suppose would be acceptable, except that it doesn't work at
runtime, because it seems as though WebSphere uses the servlet folder as
the base directory for relative paths.  I say this because if I want to
use relative paths, I must use "../include/Styles/MyCss.css" (note only
one set of "..").  Of course, that doesn't work in WDSC and gives me a
broken link.

It's particularly annoying because the <%@ include %> directive is
working correctly.  If I include from "/include/myinclude.jsp", it works
fine both in the editor and at runtime.

Anybody else running across this?

Joe

_______________________________________________
This is the Websphere Development Studio Client for iSeries  (WDSCI-L) 
mailing list
To post a message email: WDSCI-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/wdsci-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.