Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » get webapp root folder
get webapp root folder [message #198304] Tue, 14 August 2007 13:51 Go to next message
Eclipse User
Originally posted by: lornegolden.gmail.com

I have a JSP page that uses a bean to create a file in the webapps root
folder which I get from application.getRealPath("/"). Then I use a JSP
include action to include this file in another JSP. When I used tomcat
this worked without a problem but in Eclipse it does not seem to work.
When I looked for the file I found it was created in the following
directory:
C:\Documents and Settings\Lorne
Golden\workspace\.metadata\.plugins\org.eclipse.wst.server.c ore\tmp0\webapps\AcmeWeb
and did not exist in the WebContent folder of my WebApp

Any help greatly appreciated. I have been using JCreator and it works but
so inferior to Eclipse though this problem is making me backtrack.

Thanks in Advance,

Lorne
Re: get webapp root folder [message #198312 is a reply to message #198304] Tue, 14 August 2007 14:52 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1293
Registered: July 2009
Senior Member
WTP doesn't assume your project's folder structure matches that for WAR
files, so it doesn't try to serve your project directly from your
workspace under normal circumstances. Instead, the resources from your
project are combined with resources which may reside outside of your
project (typically jars) during the server publish operation. The
directory you found is the standard publish destination for this webapp.
For details about how the Tomcat server works see the Tomcat FAQ[1].

Self modifying webapps is not a use case that is supported very well by
the WTP Tomcat plug-ins. During each publish operation, the created
file(s) will be deleted from the destination in an effort to sync the
published webapp with your WebContent folder. If a file exists at the
publish destination, but doesn't exist in WebContent, it assumes it was
deleted from WebContent and now needs to be deleted from the publish
destination.

In WTP 2.0, the Tomcat server has an option to "Serve modules without
publishing", which works with Tomcat 5.0.x and later. It may help in
your case. However, it uses a number of tricks to do this, so I can't
promise that there won't be side effects that create other problems.

Cheers,
Larry

[1] http://www.eclipse.org/webtools/faq/TomcatServerFAQ.php

Lorne wrote:
> I have a JSP page that uses a bean to create a file in the webapps root
> folder which I get from application.getRealPath("/"). Then I use a JSP
> include action to include this file in another JSP. When I used tomcat
> this worked without a problem but in Eclipse it does not seem to work.
> When I looked for the file I found it was created in the following
> directory:
> C:\Documents and Settings\Lorne
> Golden\workspace\.metadata\.plugins\org.eclipse.wst.server.c ore\tmp0\webapps\AcmeWeb
>
> and did not exist in the WebContent folder of my WebApp
>
> Any help greatly appreciated. I have been using JCreator and it works
> but so inferior to Eclipse though this problem is making me backtrack.
>
> Thanks in Advance,
>
> Lorne
>
Re: get webapp root folder [message #198320 is a reply to message #198312] Tue, 14 August 2007 16:28 Go to previous messageGo to next message
Eclipse User
Originally posted by: lornegolden.gmail.com

Thanks for the insight Larry but let me ask then if it publishes my webapp
to that folder then I create a file in that folder during runtime why
would a JSP include not find that file? It does find the other files I jsp
include that were in the WebContents folder before publication?
Re: get webapp root folder [message #198356 is a reply to message #198320] Wed, 15 August 2007 09:15 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1293
Registered: July 2009
Senior Member
I'm not aware of any reason why such a created file would not be visible
in the webapp. If you use the browser to access the created file
directly, does that compile the JSP and return the partial page?

Larry

Lorne wrote:
> Thanks for the insight Larry but let me ask then if it publishes my
> webapp to that folder then I create a file in that folder during runtime
> why would a JSP include not find that file? It does find the other files
> I jsp include that were in the WebContents folder before publication?
>
Re: get webapp root folder [message #198428 is a reply to message #198356] Wed, 15 August 2007 17:53 Go to previous message
Eclipse User
Originally posted by: lornegolden.gmail.com

thanks Larry you indirectly solved my problem. When I loaded the file
directly in the browser it worked so then I realized that it must be
something else which turned out to be the actual include statement. Turns
out I forgot the = in the <%= %> statement of the page attribute. Thanks
for your help i did learn alot about how tomcat works with Eclipse through
this process all to find a missing = sign.

Lorne

Larry Isaacs wrote:

> I'm not aware of any reason why such a created file would not be visible
> in the webapp. If you use the browser to access the created file
> directly, does that compile the JSP and return the partial page?

> Larry

> Lorne wrote:
>> Thanks for the insight Larry but let me ask then if it publishes my
>> webapp to that folder then I create a file in that folder during runtime
>> why would a JSP include not find that file? It does find the other files
>> I jsp include that were in the WebContents folder before publication?
>>
Previous Topic:using org.eclipse.wst.xml.core.errorCustomizer
Next Topic:Project/Workspace Caching?
Goto Forum:
  


Current Time: Tue Jul 22 11:47:33 EDT 2014

Powered by FUDForum. Page generated in 0.02304 seconds