As suggested by others in the comments, I solved this by creating a servlet and passing in the info to the jsp, like this:
public class FooServlet extends HttpServlet
{
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
Bar bar = new Bar();
request.setAttribute("bar", bar.getFooBar() );
request.getRequestDispatcher("/myPage.jsp").forward(request, response);
}
}
In the jsp:
<%=request.getAttribute("bar") %>