开发者

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 开发者_如何学Godid 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 e.g. <%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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜