我想打印从函数返回的字符串值。
但即使是这个简单的过程,我也会收到错误。
错误:
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>
18: <jsp:getProperty name="person" property="lastName"></jsp:getProperty>
19: </body>
答案 0 :(得分:0)
在你的代码:
16: <%=System.out.println(s)%>
这将是
16: <%=s %>
因为它被解释为<% out.print(s) %>
。