Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Page Rendering Puzzle
Page Rendering Puzzle [message #209201] Thu, 28 February 2008 18:27 Go to next message
Eclipse User
Originally posted by: gmrenak.topdownsoftware.com

Eclipse 3.3.1.1, Tomcat 5

I'm experiencing puzzling rendering behavior for JSP pages. These JSP
pages have image links and an href link to a certain .css file.

To describe this problem, let me focus on just two jsp pages: page 1 is
the home page at the root level of the Web application, page 2 is
another jsp page that happens to be down one level in a subdirectory off
the root level. Page 1 contains a link to page 2.

If I highlight page 2 within the Web project, then right-click 'Run on
Server', it is rendered correctly (that is, Tomcat seems to have found
the .css file, all linked images, and formatted the page as expected)

Now, if I highlight the project, then right-click 'Run on Server', I get
page 1 (the Web app's home page) rendered correctly (Tomcat found the
..css file and all linked images). However, when I click the link to page
2 from page 1, I find that it's not rendered correctly: as though Tomcat
couldn't find the .css file and linked images for page 2.

The paths to the .css and images are correct for both pages, before and
after rendering.

There must be something fundamental here that I don't understand.

If it matters, besides the HTML, page 2 also contains Struts2 'iterator'
tags.

Gary
Re: Page Rendering Puzzle [message #209252 is a reply to message #209201] Fri, 29 February 2008 01:16 Go to previous messageGo to next message
Eclipse User
Originally posted by: gmrenak.topdownsoftware.com

Gary Mrenak wrote:
> Eclipse 3.3.1.1, Tomcat 5
>
> I'm experiencing puzzling rendering behavior for JSP pages. These JSP
> pages have image links and an href link to a certain .css file.
>
> To describe this problem, let me focus on just two jsp pages: page 1 is
> the home page at the root level of the Web application, page 2 is
> another jsp page that happens to be down one level in a subdirectory off
> the root level. Page 1 contains a link to page 2.
>
> If I highlight page 2 within the Web project, then right-click 'Run on
> Server', it is rendered correctly (that is, Tomcat seems to have found
> the .css file, all linked images, and formatted the page as expected)
>
> Now, if I highlight the project, then right-click 'Run on Server', I get
> page 1 (the Web app's home page) rendered correctly (Tomcat found the
> .css file and all linked images). However, when I click the link to page
> 2 from page 1, I find that it's not rendered correctly: as though Tomcat
> couldn't find the .css file and linked images for page 2.
>
> The paths to the .css and images are correct for both pages, before and
> after rendering.
>
> There must be something fundamental here that I don't understand.
>
> If it matters, besides the HTML, page 2 also contains Struts2 'iterator'
> tags.
>
> Gary

Problem solved, although not yet entirely understood.

I constructed the jsp pages using Dreamweaver, which was configured to
treat paths as 'relative'. So, when I added a link to page 2 (which
resided in a subdirectory off the root directory) for the .css file, for
example, it constructed a link similar to '../css/abc.css', because the
..css file was in a separate subdirectory (css) off the root directory.

It appears, however, that when the jsp page is submitted to Tomcat for
rendering, it treats the submitted page as if it were in the root
directory (even though it resides in a subdirectory off of the root
directory), and so can't find '../css/abc.css'. When I changed the path
to 'css/abc.css' it found the file.

Why would Tomcat do that?

Gary
Re: Page Rendering Puzzle [message #209389 is a reply to message #209252] Mon, 03 March 2008 16:25 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1310
Registered: July 2009
Senior Member
Gary Mrenak wrote:
> Gary Mrenak wrote:
>> Eclipse 3.3.1.1, Tomcat 5
>>
>> I'm experiencing puzzling rendering behavior for JSP pages. These JSP
>> pages have image links and an href link to a certain .css file.
>>
>> To describe this problem, let me focus on just two jsp pages: page 1
>> is the home page at the root level of the Web application, page 2 is
>> another jsp page that happens to be down one level in a subdirectory
>> off the root level. Page 1 contains a link to page 2.
>>
>> If I highlight page 2 within the Web project, then right-click 'Run on
>> Server', it is rendered correctly (that is, Tomcat seems to have found
>> the .css file, all linked images, and formatted the page as expected)
>>
>> Now, if I highlight the project, then right-click 'Run on Server', I
>> get page 1 (the Web app's home page) rendered correctly (Tomcat found
>> the .css file and all linked images). However, when I click the link
>> to page 2 from page 1, I find that it's not rendered correctly: as
>> though Tomcat couldn't find the .css file and linked images for page 2.
>>
>> The paths to the .css and images are correct for both pages, before
>> and after rendering.
>>
>> There must be something fundamental here that I don't understand.
>>
>> If it matters, besides the HTML, page 2 also contains Struts2
>> 'iterator' tags.
>>
>> Gary
>
> Problem solved, although not yet entirely understood.
>
> I constructed the jsp pages using Dreamweaver, which was configured to
> treat paths as 'relative'. So, when I added a link to page 2 (which
> resided in a subdirectory off the root directory) for the .css file, for
> example, it constructed a link similar to '../css/abc.css', because the
> .css file was in a separate subdirectory (css) off the root directory.
>
> It appears, however, that when the jsp page is submitted to Tomcat for
> rendering, it treats the submitted page as if it were in the root
> directory (even though it resides in a subdirectory off of the root
> directory), and so can't find '../css/abc.css'. When I changed the path
> to 'css/abc.css' it found the file.
>
> Why would Tomcat do that?
>
> Gary

For a "submitted" page in a subdirectory to appear as if it were in the
root of your webapp, it would seem to imply that the page is being
included by some other page, or is being forwarded to. Is this the case?

Cheers,
Larry
Re: Page Rendering Puzzle [message #209709 is a reply to message #209389] Wed, 05 March 2008 20:35 Go to previous message
Eclipse User
Originally posted by: gmrenak.topdownsoftware.com

Larry Isaacs wrote:
> Gary Mrenak wrote:
>> Gary Mrenak wrote:
>>> Eclipse 3.3.1.1, Tomcat 5
>>>
>>> I'm experiencing puzzling rendering behavior for JSP pages. These JSP
>>> pages have image links and an href link to a certain .css file.
>>>
>>> To describe this problem, let me focus on just two jsp pages: page 1
>>> is the home page at the root level of the Web application, page 2 is
>>> another jsp page that happens to be down one level in a subdirectory
>>> off the root level. Page 1 contains a link to page 2.
>>>
>>> If I highlight page 2 within the Web project, then right-click 'Run
>>> on Server', it is rendered correctly (that is, Tomcat seems to have
>>> found the .css file, all linked images, and formatted the page as
>>> expected)
>>>
>>> Now, if I highlight the project, then right-click 'Run on Server', I
>>> get page 1 (the Web app's home page) rendered correctly (Tomcat found
>>> the .css file and all linked images). However, when I click the link
>>> to page 2 from page 1, I find that it's not rendered correctly: as
>>> though Tomcat couldn't find the .css file and linked images for page 2.
>>>
>>> The paths to the .css and images are correct for both pages, before
>>> and after rendering.
>>>
>>> There must be something fundamental here that I don't understand.
>>>
>>> If it matters, besides the HTML, page 2 also contains Struts2
>>> 'iterator' tags.
>>>
>>> Gary
>>
>> Problem solved, although not yet entirely understood.
>>
>> I constructed the jsp pages using Dreamweaver, which was configured to
>> treat paths as 'relative'. So, when I added a link to page 2 (which
>> resided in a subdirectory off the root directory) for the .css file,
>> for example, it constructed a link similar to '../css/abc.css',
>> because the .css file was in a separate subdirectory (css) off the
>> root directory.
>>
>> It appears, however, that when the jsp page is submitted to Tomcat for
>> rendering, it treats the submitted page as if it were in the root
>> directory (even though it resides in a subdirectory off of the root
>> directory), and so can't find '../css/abc.css'. When I changed the
>> path to 'css/abc.css' it found the file.
>>
>> Why would Tomcat do that?
>>
>> Gary
>
> For a "submitted" page in a subdirectory to appear as if it were in the
> root of your webapp, it would seem to imply that the page is being
> included by some other page, or is being forwarded to. Is this the case?
>
> Cheers,
> Larry

I think your insight about '..is being forwarded to' is probably the
solution. Yes, the page is indeed being 'forwarded to' in the sense that
the "result" of a Struts2 action (where the "result type" of the action
is to build a jsp page) identifies the jsp page to be rendered on
Tomcat. So I can surmise that Tomcat can't know about the relative
position of the jsp page when it is "submitted" in this way.

Thanks for your reply.

Gary
Previous Topic:Error "The requested resource is not available" when trying WPT Tutorial
Next Topic:Re: Create new DOM document from XSD schema
Goto Forum:
  


Current Time: Sat Oct 25 05:39:09 GMT 2014

Powered by FUDForum. Page generated in 0.07980 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software