Reputation: 12582
Following is my jsp code. I'm new to JSP. I get the error shown after the code
<body>
<%!
public ArrayList<ArrayList<Leg>> trip;
public void routeManager(){
Location stLoc = new Location(60.2040521,24.96185113,"1023");
Location endLoc = new Location(60.17936316, 24.92282214 ,"1130");
RouteRetriever hrr = new RouteRetriever();
trip = hrr.getRoutes(stLoc, endLoc, false);
}
%>
<% routeManager();
System.out.println("Im here AA");%>
<%= out.println("Hello World:"+hrr.size()) %>
<p>Booooooooooooo!</p>
</body>
Error:
An error occurred at line: 30 in the jsp file: /index.jsp
The method print(boolean) in the type JspWriter is not applicable for the arguments (void)
Upvotes: 1
Views: 27092
Reputation: 5220
I think you should change
<%= out.println("Hello World:"+hrr.size()) %>
to (just output)
<%= "Hello World:"+trip.size() %>
or if you want to use println (change <%= to <%):
<% out.println("Hello World:"+hrr.size()); %>
Upvotes: 2
Reputation: 14877
<%=%>
and out.println
does not go together.
Change
To
<% out.println("Hello World:"+hrr.size()); %>
<%=%>
is a short hand converted into out.write
when Jsp page is compiled
Upvotes: 0