facebook

False Errors in JSP [Closed]

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #211494 Reply

    kldavis4
    Member

    I just created a new web project and I am seeing strange behavior with the jsp editor. A number of my jsps which reference class files in the project via import statements and inline imports, are marked with errors which say something like

    ‘The import com.blah.blahblah cannot be resolved’ next to my first import statement.

    It only seems to have a problem with my code, not any external libraries. The files that have the problem do not have the following:

    <%@page language=”java”%>

    When I insert the above, the problem is fixed. It was my understanding that this statement is optional, and thus pages without it should not have errors in them.

    Here is the info regarding my configuration:

    What operating system and version are you running?

    Mac OS X 10.3.4

    What Eclipse version and build id are you using? (Help > About Eclipse Platform)

    Version: 3.0.0
    Build id: 200406251208

    Was Eclipse freshly installed for MyEclipse?

    It was installed fresh for the 3.8 Beta-1, but then I uninstalled 3.8 Beta-1 and installed 3.8 Beta -2

    If not, was it upgraded to its current version using the update manager?

    I have run update manager and it says I have no updates.

    Are any other external plugins installed?

    No

    How many plugins in the <eclipse>/plugins directory are like org.eclipse.pde.*

    8

    What MyEclipse version are you using? (Help > About Eclipse Platform > Features)

    Version: 3.7.200
    Build id: 200407091200-3.8-Beta2

    What JDK version are you using to run Eclipse? (java -version)

    java version “1.4.2_03”
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-117.1)
    Java HotSpot(TM) Client VM (build 1.4.2-34, mixed mode)

    What JDK version are you using to launch your application server?

    Same as above

    What steps did you take that resulted in the issue?

    Created project with existing files.

    What application server are you using?

    Tomcat 5.0.25

    Are there any exceptions in the Eclipse log file? (<workspace>/.metadata/.log)

    There are a number of Graphic is Disposed exceptions which all occurred yesterday before I started working on this project

    #211593 Reply

    Riyad Kalla
    Member

    Your understanding is correct, that line is definately optional… that error you are seeing is indicative of an incorrect classpath (or Java Build Path in Eclipse). What specific is the class its complaining about and where is that class located?

    #211738 Reply

    kldavis4
    Member

    Thanks for the reply Riyad. It is definitely saying that the classpath is wrong, but it appears to be lying. Here is the problem import:

    <%@ page import=”com.product.sys.*” %>

    This package is locate in core/src/java/com.product.sys and the folder core/src/java is setup as a source folder in the project properties. Also, as mentioned above, the error flag disappears when I put the language statement in. It is very weird.

    #211739 Reply

    Riyad Kalla
    Member

    but it appears to be lying.

    Haha, I can just see this bug report in our system: “JSP Editor is a liar”

    Hmm I checked the JSP spec, and I think this sheds some light on why this is happening:

    import An import attribute describes the types that are available to
    the scripting environment. The value is as in an import
    declaration in the Java programming language, a (comma
    separated) list of either a fully qualified Java programming
    language type name denoting that type, or of a package name
    followed by the .* string, denoting all the public types
    declared in that package. The import list shall be imported
    by the translated JSP page implementation and is thus
    available to the scripting environment.
    The default import list is java.lang.*, javax.servlet.*,
    javax.servlet.jsp.* and javax.servlet.http.*.
    This attribute is currently only defined when the value of the
    language directive is java.

    So it seems if you do need to set the page language if you want to use imports.

    #211743 Reply

    kldavis4
    Member

    Interesting. This is a fair response, although I might propose that whatever is doing the error checking not show this as an error for convenience sake. Thanks for your help Riyad.

    #211744 Reply

    Riyad Kalla
    Member

    No problem, I learned something new today as well.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: False Errors in JSP [Closed]

You must be logged in to post in the forum log in