What is import attribute in JSP?


The import attribute serves the same function as and behaves like, the Java import statement. The value for the import option is the name of the package you want to import.

To import java.sql.*, use the following page directive −

<%@ page import = "java.sql.*" %>

To import multiple packages, you can specify them separated by comma as follows −

<%@ page import = "java.sql.*,java.util.*" %>

By default, a container automatically imports java.lang.*, javax.servlet.*, javax.servlet.jsp.*, and javax.servlet.http.*.

Updated on: 30-Jul-2019

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements