⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _action__jsp.java

📁 JSP聊天系统
💻 JAVA
字号:
/*
 * JSP generated by Resin 2.1.2 (built Tue Jun 11 08:26:56 PDT 2002)
 */

package _news._admin._info;
import javax.servlet.*;
import javax.servlet.jsp.*;
import javax.servlet.http.*;
import org.ehotsoft.yekki.sql.SQLFacade;
import org.ehotsoft.yekki.util.ParamUtil;
import org.ehotsoft.yekki.util.SkinUtil;
import java.sql.ResultSet;
import java.sql.PreparedStatement;
import java.sql.Connection;
import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;

public class _action__jsp extends com.caucho.jsp.JavaPage{
  private boolean _caucho_isDead;
  
  public void
  _jspService(javax.servlet.http.HttpServletRequest request,
              javax.servlet.http.HttpServletResponse response)
    throws java.io.IOException, javax.servlet.ServletException
  {
    com.caucho.jsp.QPageContext pageContext = (com.caucho.jsp.QPageContext) com.caucho.jsp.QJspFactory.create().getPageContext(this, request, response, null, true, 8192, true);
    javax.servlet.jsp.JspWriter out = (javax.servlet.jsp.JspWriter) pageContext.getOut();
    javax.servlet.ServletConfig config = getServletConfig();
    javax.servlet.Servlet page = this;
    javax.servlet.http.HttpSession session = pageContext.getSession();
    javax.servlet.ServletContext application = pageContext.getServletContext();
    response.setContentType("text/html;charset=gb2312");
    request.setCharacterEncoding("GB2312");
    try {
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      
	String action = ParamUtil.getStringParameter( request, "action" );
	
	SQLFacade facade = new SQLFacade();
	String sql = null;
	Connection cnn = null;
	PreparedStatement pstmt = null;

	if ( action.equals( "add_category" ) ) {
		
		String caption = ParamUtil.getStringParameter( request, "caption" );
		String dir = ParamUtil.getStringParameter( request, "dir" );
		
		if ( caption .equals( "" ) || dir.equals( "" ) ) {
			
			SkinUtil.alert( out, "请将信息填写完整!" );
		}
		else {

			sql = "insert into tbl_info_category values( seq_info.nextval, '" + caption + "','" + dir + "', TO_DATE( '1944-4-16', 'YYYY-MM-DD' ) )";
			facade.executeUpdate( sql );
			
			facade.close();

			response.sendRedirect( "category.jsp" );
		}
	}

	if ( action.equals( "edit_category" ) ) {
		
		int id = ParamUtil.getIntParameter( request, "id" );
		String caption = ParamUtil.getStringParameter( request, "caption" );
		String dir = ParamUtil.getStringParameter( request, "dir" );
		
		if ( caption .equals( "" ) || dir.equals( "" ) || ( id == -1 ) ) {
			
			SkinUtil.alert( out, "请将信息填写完整!" );
		}
		else {

			sql = "update tbl_info_category set caption=?, dir=? where id=?";

			cnn = facade.getConnection();
			pstmt = cnn.prepareStatement( sql );

			pstmt.setString( 1, caption );
			pstmt.setString( 2, dir );
			pstmt.setInt( 3, id );

			pstmt.execute();
			pstmt.close();
			facade.close();

			response.sendRedirect( "category.jsp" );
		}
	}

	if ( action.equals( "del_category" ) ) {
		
		String id = ParamUtil.getStringParameter( request, "id" );
		
		sql = "delete from tbl_info_category where id=" + id;
		facade.executeUpdate( sql );
		
		facade.close();

		response.sendRedirect( "category.jsp" );
	}

	if ( action.equals( "add_template" ) ) {
		
		String caption = ParamUtil.getStringParameter( request, "caption" );
		String content = ParamUtil.getStringParameter( request, "content" );

		/*byte[] bContent = content.getBytes( "GBK" );
		ByteArrayInputStream bais = new ByteArrayInputStream( bContent );
		InputStreamReader isr = new InputStreamReader( bais, "GBK" );
		*/

		sql = "insert into tbl_info_template values( seq_info.nextval, ?, ? )";
		
		cnn = facade.getConnection();
		pstmt = cnn.prepareStatement( sql );

		pstmt.setString( 1, caption );
		//pstmt.setCharacterStream( 2, isr, bContent.length );
		pstmt.setString( 2, content );
		pstmt.execute();
		pstmt.close();
		
		facade.close();

		response.sendRedirect( "template.jsp" );
	}

	if ( action.equals( "edit_template" ) ) {
		
		String caption = ParamUtil.getStringParameter( request, "caption" );
		String content = ParamUtil.getStringParameter( request, "content" );
		int id = ParamUtil.getIntParameter( request, "id", -1 );
		sql = "update tbl_info_template set caption=?,content=? where id=?";
		cnn = facade.getConnection();
		pstmt = cnn.prepareStatement( sql );

		pstmt.setString( 1, caption );
		pstmt.setString( 2, content );
		pstmt.setInt( 3, id );

		pstmt.execute();
		pstmt.close();

		facade.close();

		response.sendRedirect( "template.jsp" );

	}

	if ( action.equals( "del_template" ) ) {
		
		int id = ParamUtil.getIntParameter( request, "id", -1 );
		sql = "delete from tbl_info_template where id=" + id;

		facade.executeUpdate( sql );

		response.sendRedirect( "template.jsp" );
	}

	if ( action.equals( "add_article" ) ) {
		
		String title = ParamUtil.getStringParameter( request, "title" );
		String content = ParamUtil.getStringParameter( request, "content" );
		String derivation = ParamUtil.getStringParameter( request, "derivation" );
		String about = ParamUtil.getStringParameter( request, "about" );
		String author = ParamUtil.getStringParameter( request, "author" );

		int category_id = ParamUtil.getIntParameter( request, "category_id", -1 );
		int template_id = ParamUtil.getIntParameter( request, "template_id", -1 );
		boolean has_check = ParamUtil.getCheckboxParameter( request, "has_check" );
		boolean has_pic = ParamUtil.getCheckboxParameter( request, "has_pic" );
		boolean is_recommend = ParamUtil.getCheckboxParameter( request, "is_recommend" );
		
		if ( title.equals( "" ) || content.equals( "" ) ) {
			
			SkinUtil.alert( out, "请输入标题!" );
		}
		else {

			sql = "insert into tbl_info_article( id, category_id, template_id, title, content, derivation, about, author, has_check, has_pic, is_recommend, create_on ) values( seq_info.nextval, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, TO_DATE( '2002-4-16','YYYY-MM-DD' ) )";

			cnn = facade.getConnection();
			pstmt = cnn.prepareStatement( sql );
			
			pstmt.setInt( 1, category_id );
			pstmt.setInt( 2, template_id );
			pstmt.setString( 3, title );
			pstmt.setString( 4, content );
			pstmt.setString( 5, derivation );
			pstmt.setString( 6, about );
			pstmt.setString( 7, author );
			pstmt.setInt( 8, has_check ? 1 : 0 );
			pstmt.setInt( 9, has_pic ? 1 : 0 );
			pstmt.setInt( 10, is_recommend ? 1 : 0 );
			pstmt.execute();
			pstmt.close();

			facade.close();

			response.sendRedirect( "add_article.jsp" );
		}
	}

	if ( action.equals( "check_article" ) ) {
		
		int id = ParamUtil.getIntParameter( request, "id", -1 );
		sql = "update tbl_info_article set can_pass = 1 where id=" + id;
		facade.executeUpdate( sql );

		response.sendRedirect( "article.jsp" );
	}

	if ( action.equals( "edit_article" ) ) {
		
		String title = ParamUtil.getStringParameter( request, "title" );
		String content = ParamUtil.getStringParameter( request, "content" );
		int id = ParamUtil.getIntParameter( request, "id", -1 );
		int page_no = ParamUtil.getIntParameter( request, "page_no", 1 );
		int category_id = ParamUtil.getIntParameter( request, "category_id", -1 );
		
		if ( title.equals( "" ) || content.equals( "" ) || ( id == -1 ) ) {
			
			SkinUtil.alert( out, "请输入标题!" );
		}
		else {

			sql = "update tbl_info_article set title=?,content=? where id=?";
			cnn = facade.getConnection();
			pstmt = cnn.prepareStatement( sql );

			pstmt.setString( 1, title );
			pstmt.setString( 2, content );
			pstmt.setInt( 3, id );

			pstmt.execute();
			pstmt.close();

			facade.close();

			response.sendRedirect( "article.jsp?category_id=" + category_id + "&page_no=" + page_no );
		}
	}

	if ( action.equals( "del_article" ) ) {
		
		int id = ParamUtil.getIntParameter( request, "id", -1 );
		int page_no = ParamUtil.getIntParameter( request, "page_no", 1 );
		int category_id = ParamUtil.getIntParameter( request, "category_id", -1 );

		sql = "delete from tbl_info_article where id=" + id;

		facade.executeUpdate( sql );

		response.sendRedirect( "article.jsp?category_id=" + category_id + "&page_no=" + page_no );
	}

    } catch (java.lang.Throwable _jsp_e) {
      pageContext.handlePageException(_jsp_e);
    } finally {
      JspFactory.getDefaultFactory().releasePageContext(pageContext);
    }
  }

  private com.caucho.java.LineMap _caucho_line_map;
  private java.util.ArrayList _caucho_depends = new java.util.ArrayList();

  public boolean _caucho_isModified()
  {
    if (_caucho_isDead)
      return true;
    if (com.caucho.util.CauchoSystem.getVersionId() != 2057024144)
      return true;
    for (int i = _caucho_depends.size() - 1; i >= 0; i--) {
      com.caucho.vfs.Depend depend;
      depend = (com.caucho.vfs.Depend) _caucho_depends.get(i);
      if (depend.isModified())
        return true;
    }
    return false;
  }

  public long _caucho_lastModified()
  {
    return 0;
  }

  public com.caucho.java.LineMap _caucho_getLineMap()
  {
    return _caucho_line_map;
  }

  public void destroy()
  {
      _caucho_isDead = true;
      super.destroy();
  }

  public void init(com.caucho.java.LineMap lineMap,
                   com.caucho.vfs.Path appDir)
    throws javax.servlet.ServletException
  {
    com.caucho.vfs.Path resinHome = com.caucho.util.CauchoSystem.getResinHome();
    com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath();
    mergePath.addMergePath(appDir);
    mergePath.addMergePath(resinHome);
    mergePath.addClassPath(getClass().getClassLoader());
    _caucho_line_map = new com.caucho.java.LineMap("_action__jsp.java", "/test/news/admin/info/action.jsp");
    _caucho_line_map.add(11, 1);
    _caucho_line_map.add(1, 35);
    _caucho_line_map.add(5, 38);
    _caucho_line_map.add(9, 41);
    com.caucho.vfs.Depend depend;
    depend = new com.caucho.vfs.Depend(appDir.lookup("news/admin/info/action.jsp"), 1029146755924L, 7283L);
    _caucho_depends.add(depend);
  }

  private static byte []_jsp_string1;
  private static byte []_jsp_string0;
  static {
    try {
      _jsp_string1 = "\r\n\r\n".getBytes("GB2312");
      _jsp_string0 = "\r\n".getBytes("GB2312");
    } catch (java.io.UnsupportedEncodingException e) {
      e.printStackTrace();
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -