001 package jsp.jsp2.jspattribute;
002
003 import javax.servlet.*;
004 import javax.servlet.http.*;
005 import javax.servlet.jsp.*;
006
007 public final class jspattribute_jsp extends org.apache.jasper.runtime.HttpJspBase
008 implements org.apache.jasper.runtime.JspSourceDependent {
009
010 private static java.util.List _jspx_dependants;
011
012 public Object getDependants() {
013 return _jspx_dependants;
014 }
015
016 public void _jspService(HttpServletRequest request, HttpServletResponse response)
017 throws java.io.IOException, ServletException {
018
019 JspFactory _jspxFactory = null;
020 PageContext pageContext = null;
021 HttpSession session = null;
022 ServletContext application = null;
023 ServletConfig config = null;
024 JspWriter out = null;
025 Object page = this;
026 JspWriter _jspx_out = null;
027 PageContext _jspx_page_context = null;
028
029
030 try {
031 _jspxFactory = JspFactory.getDefaultFactory();
032 response.setContentType("text/html");
033 pageContext = _jspxFactory.getPageContext(this, request, response,
034 null, true, 8192, true);
035 _jspx_page_context = pageContext;
036 application = pageContext.getServletContext();
037 config = pageContext.getServletConfig();
038 session = pageContext.getSession();
039 out = pageContext.getOut();
040 _jspx_out = out;
041
042 out.write("<!--\n Licensed to the Apache Software Foundation (ASF) under one or more\n contributor license agreements. See the NOTICE file distributed with\n this work for additional information regarding copyright ownership.\n The ASF licenses this file to You under the Apache License, Version 2.0\n (the \"License\"); you may not use this file except in compliance with\n the License. You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n-->\n\n\n<html>\n <head>\n <title>JSP 2.0 Examples - jsp:attribute and jsp:body</title>\n </head>\n <body>\n <h1>JSP 2.0 Examples - jsp:attribute and jsp:body</h1>\n <hr>\n <p>The new <jsp:attribute> and <jsp:body> \n standard actions can be used to specify the value of any standard\n");
043 out.write(" action or custom action attribute.</p>\n <p>This example uses the <jsp:attribute>\n standard action to use the output of a custom action invocation\n (one that simply outputs \"Hello, World!\") to set the value of a\n bean property. This would normally require an intermediary\n step, such as using JSTL's <c:set> action.</p>\n <br>\n ");
044 jsp2.examples.FooBean foo = null;
045 synchronized (_jspx_page_context) {
046 foo = (jsp2.examples.FooBean) _jspx_page_context.getAttribute("foo", PageContext.PAGE_SCOPE);
047 if (foo == null){
048 foo = new jsp2.examples.FooBean();
049 _jspx_page_context.setAttribute("foo", foo, PageContext.PAGE_SCOPE);
050 out.write("\n Bean created! Setting foo.bar...<br>\n ");
051 out = _jspx_page_context.pushBody();
052 // my:helloWorld
053 jsp2.examples.simpletag.HelloWorldSimpleTag _jspx_th_my_helloWorld_0 = new jsp2.examples.simpletag.HelloWorldSimpleTag();
054 _jspx_th_my_helloWorld_0.setJspContext(_jspx_page_context);
055 _jspx_th_my_helloWorld_0.doTag();
056 String _jspx_temp0 = ((javax.servlet.jsp.tagext.BodyContent)out).getString();
057 out = _jspx_page_context.popBody();
058 org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(_jspx_page_context.findAttribute("foo"), "bar", _jspx_temp0, null, null, false);
059 out.write("\n ");
060 }
061 }
062 out.write("\n <br>\n Result: ");
063 out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${foo.bar}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
064 out.write("\n </body>\n</html>\n");
065 } catch (Throwable t) {
066 if (!(t instanceof SkipPageException)){
067 out = _jspx_out;
068 if (out != null && out.getBufferSize() != 0)
069 out.clearBuffer();
070 if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
071 }
072 } finally {
073 if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
074 }
075 }
076 }