Java Reference
In-Depth Information
16
}
// end
// begin
out.write(“\r\n </td>\r\n </tr>\r\n” +
“ <tr bgcolor=\”lightgrey\”>\r\n <td>\r\n “ +
“ Years of Employment:\r\n </td>\r\n <td>\r\n “ +
“ 7\r\n </td>\r\n </tr>\r\n </table>\r\n “ +
“</body>\r\n</html>\r\n”);
// end
}
catch (Exception ex) {
if (out.getBufferSize() != 0)
out.clear();
pageContext.handlePageException(ex);
}
finally {
out.flush();
_jspxFactory.releasePageContext(pageContext);
}
}
The include is actually taking place in the following code snippet from the _jspService()
method mentioned earlier:
{
String _jspx_qStr = “”;
out.flush();
_jspx_qStr = _jspx_qStr + “?employee=” + “Bob”;
_jspx_qStr = _jspx_qStr + “&title=” + “Engineer”;
pageContext.include(“header.jsp” + _jspx_qStr);
}
You can see that the string _jspx qStr is created and then the parameter list, which was cre-
ated using the <jsp:param> standard action, is appended to it. This is what forms the query
string that will be passed to your included JSP. When the string is ready, it is passed to the
pageContext.include() method with the name of the JSP to include. Now the included JSP
can parse the passed-in query string.
As you can see, the generated servlet does not directly contain the output from the included
JSP. This is because the output is included during request-time. This makes it possible for you
to make changes to the included JSP without restarting the JSP engine.
 
Search WWH ::




Custom Search