imports do not seem to work in jsp pages

View: New views
2 Messages — Rating Filter:   Alert me  

imports do not seem to work in jsp pages

by muzzamo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I followed the WTP mini how-to at
http://docs.codehaus.org/display/M2ECLIPSE/WTP+mini+howto .

After creating the project, i went into java resources and created a
new class called "Foo.java" in the package "bar".

I then went into index.jsp (the Hello, World! page) and added the line

<%@page import="bar.Foo;" %>

to the top.

Eclipse then gives me an error in the errors view saying "The import
bar cannot be resolved".

Is this a bug? Or am I doing something wrong.

Thanks again :-)

Murray

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: imports do not seem to work in jsp pages

by Igor Fedorenko-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Murray,

According to maven convention, java sources should be located under
src/main/java directory. You can find more information about default
maven project layout here
http://maven.apache.org/guides/getting-started/index.html.

To make this work in m2e do the following

1. create src/main/java directory
2. right-click on the project and run Maven->Update Project
Configuration. src/main/java should appear as sources folder in Package
Explorer at this point
3. create foo.Bar class in src/main/java
4. right-click on the project and run Validate to make WTP revalidate
your JSP

Let me know if this helps.


Murray Waters wrote:

> Hi,
>
> I followed the WTP mini how-to at
> http://docs.codehaus.org/display/M2ECLIPSE/WTP+mini+howto .
>
> After creating the project, i went into java resources and created a
> new class called "Foo.java" in the package "bar".
>
> I then went into index.jsp (the Hello, World! page) and added the line
>
> <%@page import="bar.Foo;" %>
>
> to the top.
>
> Eclipse then gives me an error in the errors view saying "The import
> bar cannot be resolved".
>
> Is this a bug? Or am I doing something wrong.
>
> Thanks again :-)
>
> Murray
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email