How to include jsp include directive in JspWriter
I have my r开发者_StackOverflow中文版equirement like this
buffer.append("<table width="+tableWidth+" height="+tableHeight+">" +
"<tr>" +
"<td class="+cssTableBackGround+">" +
NBSP2+
"" +
"<img id='"+ID+"' border="+0+" src="+imageDown+" name='toggleImage'/> (\"javascript:simpleToggle('"+ADVANCED+"',) " +
NBSP2+
"<font class="+cssClass+"> "+
"Edit ChairPerson" +
"</td></tr></table>" +
"<div id='"+ADVANCED+"' style='background-color:#cccccc;display:none; overflow:hidden;height:95px;width:75%'>"+
"<%@ include file=\"advancedEpanded.jsp\" %>" +
"</div>");
JspWriter out = pc.getOut();
out.write(buffer.toString());
i need to include another jsp in the code. is there a way to do it? i tried with jsp include also. but i canot see the content ont the screen.
Best solution would be to move all that HTML code out into a JSP file, there where it actually belongs, then you'll be able to put a <jsp:include>
somewhere along the lines.
<jsp:include page="foo.jsp" />
If you really insist in keep doing this the ugly way, then use RequestDispatcher#include()
.
request.getRequestDispatcher("foo.jsp").include(request, response);
精彩评论