谁说不能写方法,看
<%!
// you function
%>
<%!
// you function
%>
解决方案 »
- jsp response.getWrite()和response.GetouputResponse()冲突
- 如何在页面保存一隐藏数组,并被js使用。
- 关于下载代码的问题
- 为什么用eclipse写jsp不生成.java文件?
- 画图求助
- 高分求JSTL问题
- 大家讨论一下TOMCAT能不能支持日访问量在50万的网站.
- Oracle存储过程的时间问题
- 求教:数据库抛出异常Invalid operation for the current cursor position.
- Cannot convert value '0000-00-00 00:00:00' from column 5 to TIMESTAMP.
- how to call servlet from browser and transfer parameters?
- 关于(二次)代理的问题
我想请问一下 ! 代表什么?
void abc(){
%>
<table> //会出错
</table>
<%
out.println("<tr>"); //也会出错
}
%>为什么?怎么办?
<%!%>还是不能显示 html 呀?
! 到底是起什么作用?
! 是用来声明插入 servlet 类 的方法和成员变量,不会有任何输出。我现在的解决办法是
<%! //test
void xx(HttpServletResponse response) throws ioException{ java.io.PrintWriter out = response.getWriter();
out.println("<html><h1>asdfasfilugasdfiug");}
%>然后调用
<% xx(response); %>我觉得这样很蠢,完全失去了用 jsp 的方便。你们肯定有更好的方法,快告诉我吧!!!
不过我现在知道可以用 include 带参数了。