Eclipse is not importing classes in jsp files

2019-06-09 13:05发布

问题:

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?

回答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.