简体   繁体   中英

How to integrate Eclipse Dynamic Web Project Folder structure with Tomcat6

I want to create a web project in Eclipse, but I don't understand the Folder Structure of the project. It is different with the "webapps" folder layout which state in Tomcat6 Folder. Could anyone tell me which folder I should put web file(like: html, jsp), which folder I should put java source, which folder I should put the servlet file.

Here is the Project in Eclipse:

 Web Project - build - Webcontent * META-INF * WEB-INF * - scr (not default one) * - classes(not default one) * - web.xml - JavaSource * scr 

now what I did is put .java file into /JavaSource/src , and put .jsp file into /WebProject/WEB-INF, and when I import such as "test.java" into "index.jsp" I write following:

<%page import="test.java" %>

but it shows error in eclipse. what is the correct way of organize those files to create a meaningful standard project.

  1. You should put *.jsp files under WebProject/WebContent
  2. You should put *.java source files under WebProject/JavaSource/src/your/package/name
  3. To reference a java class from JSP you need to use its fully qualified name eg <%page import="your.package.name.Test" %> , where Test is the name of the class located in Test.java in WebProject/JavaSource/src/your/package/name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM