首页 > 开发 > JAVA > 正文

“The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit”

2015-09-24 10:26:51  来源: 网友分享

一个共通的jsp,单只测它是ok的,可是,放在别的jsp中include它,就会报错如标题所示:The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit。调用它的jsp是这样写的:< %@include file="/模块名/nani_include.jsp" % > 。于是我将这个include语句换成了<jsp:include flush="true" page="/模块名/nani_include.jsp"/>。不再 报错了。因为  <%@ include file=" "%>标签 是在jsp容器里将jsp文件翻译成servlet文件,并编译它时,是静态包含被包含jsp的,也就是编译出来是一个类文件,而java类文件是不允许超过65k这么大的,所以会报错如标题所示。而<jsp:include flush="true" page=" "/>在翻译并编译后,产生的是两个类文件,也就是说 被调用的jsp生成独立的类文件,而调用它的jsp生成的类文件中,只包含一个调用jsp的方法。


可是问题又出现了。参数传不进去。


解决方法是:调用它的jsp用<jsp:param>传参。


<jsp:include flush="true" page="/模块名/nani_include.jsp">
      <jsp:param name="ss" value="_programForm"/>  
</jsp:include>


被调用的jsp中,用el表达式接这个参数就好了:


${ss}


(不管里面用什么标签,name设成“ss”就好了)