title: Only a type can be imported. com.journaldev.model.Employee resolves to a package
body: <p>index22.jsp</p>
  
  <pre><code>&lt;%@ page import="java.util.List" %&gt;
    &lt;%@ page import="com.journaldev.model.Employee" %&gt;
  &lt;%@ page import="com.journaldev.model.Person" %&gt;
  &lt;%@ page import="com.journaldev.model.Address" %&gt;
  </code></pre>
  
  <p>when i am accessing index22.jsp on browser getting the following error:</p>
  
  <pre><code>Jul 12, 2015 8:53:37 PM org.apache.catalina.core.StandardWrapperValve invoke
  SEVERE: Servlet.service() for servlet [jsp] in context with path [/JSTL] threw exception [Unable to compile class for JSP: 
  
  An error occurred at line: [15] in the generated java file: [C:\Users\piyush\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\JSTL\org\apache\jsp\index22_jsp.java]
  Only a type can be imported. com.journaldev.model.Employee resolves to a package
  
  An error occurred at line: [16] in the generated java file: [C:\Users\piyush\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\JSTL\org\apache\jsp\index22_jsp.java]
  Only a type can be imported. com.journaldev.model.Person resolves to a package
  
  An error occurred at line: [17] in the generated java file: [C:\Users\piyush\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\JSTL\org\apache\jsp\index22_jsp.java]
  Only a type can be imported. com.journaldev.model.Address resolves to a package
  
  Stacktrace:] with root cause
  org.apache.jasper.JasperException: Unable to compile class for JSP: 
  
  An error occurred at line: [15] in the generated java file: [C:\Users\piyush\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\JSTL\org\apache\jsp\index22_jsp.java]
  Only a type can be imported. com.journaldev.model.Employee resolves to a package
  
  An error occurred at line: [16] in the generated java file: [C:\Users\piyush\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\JSTL\org\apache\jsp\index22_jsp.java]
  Only a type can be imported. com.journaldev.model.Person resolves to a package
  
  An error occurred at line: [17] in the generated java file: [C:\Users\piyush\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\JSTL\org\apache\jsp\index22_jsp.java]
  Only a type can be imported. com.journaldev.model.Address resolves to a package
  
  Stacktrace:
      at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
      at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
      at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:485)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:379)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>I have also included some JSTL jars and using Tomcat7v</p>
  
  <pre><code>javax.servlet.jsp.jstl-1.2.1.jar
  taglibs-standard-compat-1.2.5.jar
  taglibs-standard-impl-1.2.5.jar
  taglibs-standard-jstlel-1.2.5.jar
  taglibs-standard-spec-1.2.5.jar
  </code></pre>
  
  <p>I guess getting this error because of JSTL I have included but not confirmed.
  any idea about the error I am getting?</p>
  
  <p>Employee.java</p>
  
  <pre><code>package com.journaldev.model;
  
  public class Employee implements Person {
  
      private String name;
      private int id;
      private Address address;
  
      public Employee() {
      }
  
      @Override
      public String getName() {
          return this.name;
      }
  
      @Override
      public void setName(String nm) {
          this.name = nm;
      }
  
      public int getId() {
          return id;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      public Address getAddress() {
          return address;
      }
  
      public void setAddress(Address address) {
          this.address = address;
      }
  
      @Override
      public String toString(){
          return "ID="+id+",Name="+name+",Address="+address;
      }
  
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/Yt51w.png" alt="enter image description here"></p>