home *** CD-ROM | disk | FTP | other *** search
- package org.apache.jsp.xml;
-
- import java.io.IOException;
- import java.text.DateFormat;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.util.List;
- import java.util.Locale;
- import java.util.Vector;
- import javax.servlet.ServletConfig;
- import javax.servlet.ServletContext;
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import javax.servlet.http.HttpSession;
- import javax.servlet.jsp.JspFactory;
- import javax.servlet.jsp.JspWriter;
- import javax.servlet.jsp.PageContext;
- import javax.servlet.jsp.SkipPageException;
- import org.apache.jasper.runtime.HttpJspBase;
- import org.apache.jasper.runtime.JspSourceDependent;
-
- public final class xml_jsp extends HttpJspBase implements JspSourceDependent {
- private static Vector _jspx_dependants;
-
- String getDateTimeStr(Locale l) {
- DateFormat df = SimpleDateFormat.getDateTimeInstance(2, 2, l);
- return df.format(new Date());
- }
-
- public List getDependants() {
- return _jspx_dependants;
- }
-
- public void _jspService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
- JspFactory _jspxFactory = null;
- PageContext pageContext = null;
- HttpSession session = null;
- ServletContext application = null;
- ServletConfig config = null;
- JspWriter out = null;
- JspWriter _jspx_out = null;
- PageContext _jspx_page_context = null;
-
- try {
- _jspxFactory = JspFactory.getDefaultFactory();
- response.setContentType("text/html;charset=UTF-8");
- pageContext = _jspxFactory.getPageContext(this, request, response, (String)null, true, 8192, true);
- _jspx_page_context = pageContext;
- application = pageContext.getServletContext();
- config = pageContext.getServletConfig();
- session = pageContext.getSession();
- out = pageContext.getOut();
- out.write("<html>");
- out.write("<head>");
- out.write("<title>");
- out.write("Example JSP in XML format");
- out.write("</title>");
- out.write("</head>");
- out.write("<body>");
- out.write("\nThis is the output of a simple JSP using XML format. \n");
- out.write("<br/>");
- out.write("<div>");
- out.write("Use a jsp:scriptlet to loop from 1 to 10: ");
- out.write("</div>");
-
- for(int i = 1; i <= 10; ++i) {
- out.println(i);
- if (i < 10) {
- out.println(", ");
- }
- }
-
- out.write("\n <br><br>\n");
- out.write("<div align=\"left\">");
- out.write("\n Use a jsp:expression to write the date and time in the browser's locale: \n ");
- out.print(this.getDateTimeStr(request.getLocale()));
- out.write("</div>");
- out.write("\n <p>This sentence is enclosed in a jsp:text element.</p>\n");
- out.write("</body>");
- out.write("</html>");
- } catch (Throwable t) {
- if (!(t instanceof SkipPageException)) {
- if (_jspx_out != null && _jspx_out.getBufferSize() != 0) {
- _jspx_out.clearBuffer();
- }
-
- if (_jspx_page_context != null) {
- _jspx_page_context.handlePageException(t);
- }
- }
- } finally {
- if (_jspxFactory != null) {
- _jspxFactory.releasePageContext(_jspx_page_context);
- }
-
- }
-
- }
- }
-