Jsp tag file例子以及说明(12)
</html>
invokeDemo.tag
[java]
<%@ attribute name="productDetails" fragment="true" %>
<%@ variable name-given="productName" %>
<%@ variable name-given="description" %>
<%@ variable name-given="price" %>
<%
jspContext.setAttribute("productName", "Pelesonic DVD Player");
jspContext.setAttribute("description",
"Dolby Digital output through coaxial digital-audio jack," +
" 500 lines horizontal resolution-image digest viewing");
jspContext.setAttribute("price", "65");
%>
<jsp:invoke fragment="productDetails"/>//指明要在dotag()时调用 javax.servlet.jsp.tagext.JspFragment.invoke方法,回调机制
编译后的代码
invokeTest_jsp.java
[java]
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<title>Product Details</title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
相关新闻>>
- 发表评论
-
- 最新评论 更多>>