0

Windows 7 64, fresh Eclipse Java EE IDE for Web Developers. Version: Kepler Service Release 1 Build id: 20130919-0819

Eclipse is not automatically or manually importing classes in JSP files?

Despite this suggestion (look at accepted answer) which works for regular java class files (on my PC), for JSP it doesn't work?

Is there some setting that I might accidentally turned off, or I had to turn it on? I checked all usual places such as Organize Imports, Save Actions, Content Assist (JSP Files, Editor, Content Assist) and everything is checked but besides indentation (code formatting) for JSP pages nothing works?

Community
  • 1
  • 1
Nenad Bulatović
  • 7,238
  • 14
  • 83
  • 113

1 Answers1

1

Make sure your preferences have the "Add import instead of qualified name" option enabled, that you are using the JSP Editor to open your file, and that the type you want imported is on the project's Java Build Path and proposed. You should be able to add Page Import directives after the fact in Luna.

Web->JSP Files->Editor->Content Assist preferences

nitind
  • 19,089
  • 4
  • 34
  • 43
  • I just checked and everything is set up a you suggest. And actually when I create a new JSP files in Eclipse it works OK. What I was trying to edit were some external files (some source codes supplied with one book). So, I guess it is what you suspected about not using JSP editor. It seems that although opened files (I mean when I double click file it opens in Eclipse) can be formated and syntax colored that what opened them is NOT JSP editor but probably HTML editor (in Eclipse). Where should I set up JSP editor to handle them? – Nenad Bulatović Jun 16 '14 at 21:05
  • 1
    Files that aren't part of a project don't have a discernible Java Build Path. The editor literally has no knowledge of types to propose and complete without that context. They probably did open in the JSP Editor, though. – nitind Jun 17 '14 at 10:55