-2

When I hit Cmd+Space(MacOS) to import unresolved class in JSP the Eclipse automatically inserts each class in a new import row, like:

<%@page import="java.util.Map"%>
<%@page import="java.util.HashMap"%>

Is there is a way to setup Eclipse so it puts classes in one line while autocomplete?

<%@page import="java.util.Map, java.util.HashMap"%>
  • 1
    Why do you care? What difference does it make? – Jim Garrison Apr 18 '17 at 06:01
  • In the first case response begins at the process of class import. It could be a problem when I need output starts only at the JSP body. So I have to manually rewrite imports in one line to prevent early output. It just annoy me. – Rodion Shotskiy Apr 18 '17 at 07:27
  • It helps you : http://stackoverflow.com/questions/12164841/have-eclipse-automatically-import-classes-in-jsp-files-specifically. – VNT Apr 18 '17 at 07:41
  • Yeah, Intellij Idea does this way but I would like to know if that possible to do something with Eclipse. I can't switch on Idea just because of that reason. – Rodion Shotskiy Apr 18 '17 at 07:55
  • What do you mean about "response starts at..", a long time ago I worked on a system where code was written in jsps which is pretty bad practice in my opinion. Besides the point jsp files are compiled down into servlets anyway, at least with tomcat so does it really make any difference to you? – berimbolo Oct 13 '18 at 07:18

1 Answers1

0

To import more than one class, use the following format:

<%@ page import="package1.myClass1,package2.myClass2,....,packageN.myClassN" %>
Jay Smith
  • 2,331
  • 3
  • 16
  • 27