Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Re: Setting up a new dynamic web project
Re: Setting up a new dynamic web project [message #226812] Fri, 16 January 2009 16:42 Go to next message
Eclipse User
Originally posted by: nickboldt+eclipse+newsgroup.gmail.com

Copying to eclipse.webtools.

Mila Mitra wrote:
> Hello,
> I am a newbie to Eclipse.
> I have been handed two projects as directory structures, a web project
> with jsp, html, and js files. Also a separate project which has many
> Java packages and servlets.
>
> I am able to import the Java web structure to an Eclipse Java project,
> and the webfiles to a dynamic web project/WebContent area.
>
> However, the JSP files in the dynamic web project use the Java classes
> (page imports).
>
> My question is how to make this work?
> 1. Keep these as separate projects (1 dynamic web project and one Java
> project). In that case how do the import statements work from another
> project?
> OR
> 2. Put the Java packages also in the Java:src area of the dynamic web
> project? Where do I place the Servlets?
>
> This is how it currently looks:
> - TestJava (java project)
> /src
> com.app.techassist
> TechAssistApp.java
>
> - wsdev (dynamic web project)
> /WebContent
> main.jsp
>
> main.jsp has <%@ page import="com.app.techassist.TechAssistApp" %>
>
> How can I make main.jsp see the Java package? Also, how would I build
> this whole thing?
>
> I would appreciate any help.
> Thanks, Mila
>
>
>

--
Nick Boldt :: http://wiki.eclipse.org/User:Nickb
Re: Setting up a new dynamic web project [message #226818 is a reply to message #226812] Fri, 16 January 2009 17:23 Go to previous message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1310
Registered: July 2009
Senior Member
Nick Boldt wrote:
> Copying to eclipse.webtools.
>
> Mila Mitra wrote:
>> Hello,
>> I am a newbie to Eclipse.
>> I have been handed two projects as directory structures, a web project
>> with jsp, html, and js files. Also a separate project which has many
>> Java packages and servlets.
>>
>> I am able to import the Java web structure to an Eclipse Java project,
>> and the webfiles to a dynamic web project/WebContent area.
>>
>> However, the JSP files in the dynamic web project use the Java classes
>> (page imports).
>>
>> My question is how to make this work?
>> 1. Keep these as separate projects (1 dynamic web project and one Java
>> project). In that case how do the import statements work from another
>> project?

Open the Properties dialog for the web project and go to the Java EE
Module Dependencies page. Add a check for the Java project and click
OK. When the web project is published to a server or exported as a WAR
or as part of an EAR file, a jar will be created from the Java project
and included in the Web application's WEB-INF/lib.

>> OR
>> 2. Put the Java packages also in the Java:src area of the dynamic web
>> project? Where do I place the Servlets?

The artifacts built from content placed under Java:src of the web
project will be included in the Web application's WEB-INF/classes. The
default dynamic web project will build the Java content to the
"build/classes" folder of the project. When the web project is
published to a server or exported, the "build/classes" content gets
copied to or included in "WEB-INF/classes".

>>
>> This is how it currently looks:
>> - TestJava (java project)
>> /src
>> com.app.techassist
>> TechAssistApp.java
>>
>> - wsdev (dynamic web project)
>> /WebContent
>> main.jsp
>>
>> main.jsp has <%@ page import="com.app.techassist.TechAssistApp" %>
>>
>> How can I make main.jsp see the Java package?

Either approach above would fix this.

>> Also, how would I build
>> this whole thing?

As mentioned above, "assembly" occurs when the project is published to a
server or is exported as a WAR, or as part of an EAR.

Cheers,
Larry

>>
>> I would appreciate any help.
>> Thanks, Mila
>>
>>
>>
>
Previous Topic:Web Services Explorer for UDDI v3
Next Topic:Creating a web project around an existing file structure?
Goto Forum:
  


Current Time: Thu Oct 23 21:18:55 GMT 2014

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

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