JspWriter类型中的方法print(boolean)不适用于参数

时间:2016-05-03 06:42:55

标签: java jsp

我想打印从函数返回的字符串值。

但即使是这个简单的过程,我也会收到错误。

错误:

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 16 in the jsp file: /beansal.jsp
The method print(boolean) in the type JspWriter is not applicable for the arguments (void)
13: </head>
14: <body>
15: <%String s = new DBConnectionTest().Test();%>
16: <%=System.out.println(s)%>
17: <jsp:getProperty name="person" property="name"></jsp:getProperty>&nbsp;
18: <jsp:getProperty name="person" property="lastName"></jsp:getProperty>
19: </body>

1 个答案:

答案 0 :(得分:0)

在你的代码: 16: <%=System.out.println(s)%>

这将是 16: <%=s %>

因为它被解释为<% out.print(s) %>