Example #1
0
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=GBK");
      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("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");

      String path = request.getContextPath();
      String basePath =
          request.getScheme()
              + "://"
              + request.getServerName()
              + ":"
              + request.getServerPort()
              + path
              + "/";

      out.write('\r');
      out.write('\n');

      String title = request.getParameter("title");
      String content = request.getParameter("content");
      String filename = request.getParameter("filename");
      String fileurl = request.getParameter("fileurl");

      Gcxknews gcxknews = new Gcxknews();
      gcxknews.setTitle(title);
      gcxknews.setContent(content);
      gcxknews.setPubtime(new Date());
      gcxknews.setFilename(filename);
      gcxknews.setFileurl(fileurl);

      try {

        BasicDAO.save(gcxknews);
        out.println(JavaScript.alertandRedirect("保存成功", "gcxknewslist.jsp"));

      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        out.println(JavaScript.alertandBack("保存失败"));
      }

      out.write("\r\n");
      out.write("\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0) out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }