0

I have an arraylist of objects in my servlet where I want to call it in my jsp file. I'm not sure how to go about doing this.

inside my servlet I have:

public ArrayList <Song> searchedSongs = new ArrayList <Song> ();

where the object is a Song.java file. Inside my jsp file I have:

<strong style="color: #ff9642;">CART:</strong><br/>    
<% ArrayList<Song> results = (ArrayList<Song>) session.getAttribute("results"); %>
<% out.print(results.size()); %> items

I am getting an error saying my Song cannot be resolved

Kai
  • 38,985
  • 14
  • 88
  • 103
SNpn
  • 2,157
  • 8
  • 36
  • 53

1 Answers1

1

You should import the class in you JSP

<%@ page import="com.entity.Song" %>

You might refer to here

Community
  • 1
  • 1
Pau Kiat Wee
  • 9,485
  • 42
  • 40