Re: Missing images style sheet in welcome file

2003-08-26 Thread Jason Lea
sriram wrote:

Hi,

In my web application (using struts), I have login.jsp as welcome file.

I've defined the welcome file in web.xml as follows:

  welcome-file-list
welcome-file/jsp/login.jsp/welcome-file
  /welcome-file-list
And in login.jsp, I'm using relative path to load images and style sheet.

My directory structure is as follows:

---web
 |
 |--css
 |
 |--jsp
 |
 |--images
 |
 |--WEB-INF
login.jsp is located in /web/jsp folder.

In login.jsp, I'm including style sheet as follows:
link href=../css/style.css rel=stylesheet type=text/css
../css/style.css -- the style sheet is located in /web/css folder.

Now, when I browse http://localhost:8080/myApp, login.jsp is displayed as welcome page, but the style sheet is not found. Same is the case with images on login.jsp. (this problem is occurring on Linux)

But when I use http://localhost:8080/myApp/jsp/login.jsp, then it is displaying everything perfectly.

And http://localhost:8080/myApp displays the login page correctly on Windows.

Any idea what could be the problem? 

Sriram

The browser makes the request for the images and stylesheet relative to 
the path it *thinks* the login.jsp is at.  In this case it sees the 
login.jsp page as being:

http://localhost:8080/myApp/login.jsp

so when it tries to access the stylesheet it is looking for:

http://localhost:8080/myApp/../css/style.css

which becomes:

http://localhost:8080/css/style.css

and that doesn't exist.  What you can do is use some global forwards in 
your struts-config.xml such as
global-forwards
  forward name=baseStylesheet path=/css/style.css/
/global-forwards

and in your login.jsp do this:

link rel=stylesheet type=text/css href=html:rewrite 
forward='baseStylesheet' / /

Then the rewrite should put in the path relative to the web application
eg it will put in the path '/myApp/css/style.css'
You can use the html:img tags for your images.

--
Jason Lea
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Missing images style sheet in welcome file

2003-08-25 Thread sriram
Nagendra,
 
After posting the question, I realized that I haven't included html:base/ in .jsp 
file.
 
I included that and it worked fine.
 
Thanks.
Sriram

-Original Message-
From: Nagendra Kumar O V S [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 25, 2003 12:53 PM
To: [EMAIL PROTECTED]
Subject: Re: Missing images  style sheet in welcome file



hi,
have u looked in to the the final url after the page is rendered.??
have u tried using the html:base/ in ur jsp??
 
-- nagi
 
---Original Message---
 
From: Struts Users Mailing  mailto:[EMAIL PROTECTED] List
Date: Monday, August 25, 2003 12:12:56 PM
To: 'Struts Users Mailing  mailto:[EMAIL PROTECTED] List'
Subject: Missing images  style sheet in welcome file
 
Hi,

In my web application (using struts), I have login.jsp as welcome file.

I've defined the welcome file in web.xml as follows:

welcome-file-list
welcome-file/jsp/login.jsp/welcome-file
/welcome-file-list

And in login.jsp, I'm using relative path to load images and style sheet.

My directory structure is as follows:

---web
|
|--css
|
|--jsp
|
|--images
|
|--WEB-INF

login.jsp is located in /web/jsp folder.

In login.jsp, I'm including style sheet as follows:
link href=../css/style.css rel=stylesheet type=text/css

../css/style.css -- the style sheet is located in /web/css folder.

Now, when I browse http://localhost:8080/myApp, login.jsp is displayed as welcome 
page, but the style sheet is not found. Same is the case with images on login.jsp. 
(this problem is occurring on Linux)

But when I use http://localhost:8080/myApp/jsp/login.jsp, 
http://localhost:8080/myApp/jsp/login.jsp,  then it is displaying everything 
perfectly.

And http://localhost:8080/myApp displays the login page correctly on Windows.

Any idea what could be the problem? 

Sriram





 http://www.incredimail.com/redir.asp?ad_id=309lang=9   IncrediMail - Email has 
finally evolved -  http://www.incredimail.com/redir.asp?ad_id=309lang=9 Click Here 



RE: Missing images style sheet in welcome file

2003-08-25 Thread sriram
I forgot to include html:base/ in login.jsp.

I've included this and it worked!


-Original Message-
From: sriram [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 25, 2003 11:19 AM
To: 'Struts Users Mailing List'
Subject: Missing images  style sheet in welcome file


Hi,

In my web application (using struts), I have login.jsp as welcome file.

I've defined the welcome file in web.xml as follows:

  welcome-file-list
welcome-file/jsp/login.jsp/welcome-file
  /welcome-file-list

And in login.jsp, I'm using relative path to load images and style sheet.

My directory structure is as follows:

---web
 |
 |--css
 |
 |--jsp
 |
 |--images
 |
 |--WEB-INF

login.jsp is located in /web/jsp folder.

In login.jsp, I'm including style sheet as follows:
link href=../css/style.css rel=stylesheet type=text/css

../css/style.css -- the style sheet is located in /web/css folder.

Now, when I browse http://localhost:8080/myApp, login.jsp is displayed as welcome 
page, but the style sheet is not found. Same is the case with images on login.jsp. 
(this problem is occurring on Linux)

But when I use http://localhost:8080/myApp/jsp/login.jsp, then it is displaying 
everything perfectly.

And http://localhost:8080/myApp displays the login page correctly on Windows.

Any idea what could be the problem? 

Sriram