In my home.JSP file, I am trying to use an ArrayList after putting the correct package name in the @page directive. The code is executing properly but I am getting error in the JSP editor window saying "ArrayList can not be resolved to a type.
here is the code snippet (Look at the last line where the array list is created that is where I am getting the error.)
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" import="java.util.Scanner, java.util.ArrayList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body bgcolor = "green" > hey this is coming from file <% int i = Integer.parseInt(request.getParameter("num1")); int j = Integer.parseInt(request.getParameter("num2")); int k= i+j; out.println("output: "+k); String str = "hello"; ArrayList<String> ls = new ArrayList<String>(); %>