reset password
Author Message
ashoush
Posts: 25
Posted 14:18 Oct 15, 2009 |

Hi,

Here is a little question I have. Every time I add a static resource (CSS, pictures, etc.) to my project folder, or I change one,  I need to refresh the projedct in Eclipse otherwise the resource will not be avilable to the web server. My question is that what refreshing the projects in Eclipse exactly does regarding this matter and why that is necessary. Also if one is not using Eclipse, what is the manual wway for doing this.

 

Thanks,

Arash

cysun
Posts: 2935
Posted 15:25 Oct 15, 2009 |

If you do things outside Eclipse, e.g. copy files directly to the project folder using Windows Explorer, you need to refresh the project so that Eclipse is aware of the changes.

If you do things with Eclipse, e.g. add/delete/modify files in the Eclipse Project Explorer view, you do not need to refresh the project. Note that you can drag & drop files between Windows Explorer and Eclipse Project Explorer.

How to do things manually without Eclispe (or some other IDE) is a long story. The short version is that it's like putting HW2 on CS3 - you place code and other files to specific folders and let the application server to load them.

ashoush
Posts: 25
Posted 15:36 Oct 15, 2009 |

Thanks for your reply Dr. Sun.

I undestand that refreshing the project lets Eclipse know about the changes. But the question is that whyTomcat cannot see the files no metter Eclipse knows about them or not? Or let's put it in another way: how Eclipse communicate with Tomcat after you made a change to a project? I'm asking this because in some webservers (like IIS + php) you just copy the files and they are ready to be used be the webserver.

 

Thanks

Arash

 

cysun
Posts: 2935
Posted 16:25 Oct 15, 2009 |
ashoush wrote:

Thanks for your reply Dr. Sun.

I undestand that refreshing the project lets Eclipse know about the changes. But the question is that whyTomcat cannot see the files no metter Eclipse knows about them or not? Or let's put it in another way: how Eclipse communicate with Tomcat after you made a change to a project? I'm asking this because in some webservers (like IIS + php) you just copy the files and they are ready to be used be the webserver.

 

Thanks

Arash

Eclipse controls its own Tomcat instance. The Tomcat instance loads files from a temporary folder (somewhere under workspace\.metadata\.plugins\org.eclipse.wst.server.core). When you change some resource in Eclipse, Eclipse will copy it to the temporary folder so Tomcat can load it. It's a little complicated but I guess it's necessary so that Eclipse can support different application servers (Tomcat, JBoss, Glassfish etc.) and provide comprehensive debugging and profiling capabilities.

A simpler, manual setup could work just like PHP. For example, on CS3 server, simply create a JSP, e.g. test.jsp under www/, then you can access it at http://cs3.calstatela.edu:8080/<account_name>/test.jsp. If you modify the JSP file, just refresh your browser and you'll see the change, just like with PHP.

ashoush
Posts: 25
Posted 17:16 Oct 15, 2009 |

Thank you very much for the thorough explanation. Now I know what's happening in the background!