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

1 Answer 1

1

You should import the class in you JSP

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

You might refer to here

Sign up to request clarification or add additional context in comments.

1 Comment

I did add it to the top of my JSP file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.