以下是我的jsp代码。我是JSP的新手。我在代码
之后显示错误<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>
错误:
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)
答案 0 :(得分:2)
我认为你应该改变
<%= out.println("Hello World:"+hrr.size()) %>
到(只输出)
<%= "Hello World:"+trip.size() %>
或者如果你想使用println(更改&lt;%= to&lt;%):
<% out.println("Hello World:"+hrr.size()); %>
答案 1 :(得分:0)
<%=%>
和out.println
不会在一起。
更改
要
<% out.println("Hello World:"+hrr.size()); %>
<%=%>
是编译Jsp页面时转换为out.write
的简写