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

📄 _action__jsp.java

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

package _admin._poll;
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.Statement;
import java.sql.Connection;
import java.sql.SQLException;

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_string0, 0, _jsp_string0.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);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      
	String action = ParamUtil.getStringParameter( request, "action" );
	
	SQLFacade facade = new SQLFacade();
	Connection cnn = facade.getConnection();
	PreparedStatement pstm = null;
	Statement stm = null;
	String sql = null;
	
	if ( action.equals( "add_poll" ) ) {
		
		String topic_caption = ParamUtil.getStringParameter( request, "topic_caption" );
		String[] item_caption = request.getParameterValues( "item_caption" );
		int topic_id = -1;
		
		try {
		
			sql = "select seq_poll.nextval from dual";
			ResultSet rst = facade.executeQuery( sql );
			rst.next();
			topic_id = rst.getInt( 1 );
			
			sql = "insert into tbl_poll_topic( id, caption ) values( ?, ? )";
			pstm = cnn.prepareStatement( sql );
			pstm.setInt( 1, topic_id );
			pstm.setString( 2, topic_caption );
			pstm.execute();
			
			stm = cnn.createStatement();

			//should replace ' with ''
			for ( int i = 0; i < item_caption.length; i++ ) {
				
				if ( item_caption[ i ] != null && !item_caption[ i ].equals( "" ) && !item_caption[ i ].equals( "null" ) ) {

					sql = "insert into tbl_poll_item( id, topic_id, caption, hits ) values( seq_poll.nextval," + topic_id + ",'" + item_caption[ i ] + "', 0 )";

					stm.addBatch( sql );
				}
			}

			stm.executeBatch();
			cnn.commit();
			cnn.setAutoCommit( true );
		}
		catch ( SQLException e ) {
			
			cnn.rollback();
		}
			
		SkinUtil.redirect( out, "添加数据成功!", "add_poll.jsp" );
	}

	if ( action.equals( "del_poll" ) ) {
		
		int topic_id = ParamUtil.getIntParameter( request, "topic_id" );
		stm = cnn.createStatement();

		cnn.setAutoCommit( false );

		sql = "delete from tbl_poll_topic where id=" + topic_id;
		stm.addBatch( sql );
		sql = "delete from tbl_poll_item where topic_id=" + topic_id;
		stm.addBatch( sql );
		
		stm.executeBatch();
		cnn.commit();
		
		cnn.setAutoCommit( true );

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

	if ( action.equals( "edit_poll" ) ) {
		
		String topic_caption = ParamUtil.getStringParameter( request, "topic_caption" );
		String[] item_caption = request.getParameterValues( "item_caption" );
		String[] item_id = request.getParameterValues( "item_id" );
		int topic_id = ParamUtil.getIntParameter( request, "topic_id" );

		stm = cnn.createStatement();
		
		sql = "update tbl_poll_topic set caption='" + topic_caption + "' where id=" + topic_id;
		stm.addBatch( sql );
		System.out.println( sql );
		for ( int i = 0; i < item_caption.length; i++ ) {
			
			sql = "update tbl_poll_item set caption='" + item_caption[ i ] + "' where id=" + item_id[ i ];
			stm.addBatch( sql );		
		}

		for ( int i = 0; i < item_id.length; i++ ) {
			
			if ( item_caption[ i ] != null && !item_caption[ i ].equals( "" ) && !item_caption[ i ].equals( "null" ) && item_id[ i ].equals( "-1" ) ) {
				
				sql = "insert into tbl_poll_item( id, topic_id, caption, hits ) values( seq_poll.nextval," + topic_id + ",'" + item_caption[ i ] + "', 0 )";
			
				stm.addBatch( sql );
			}

		}

		stm.executeBatch();
		cnn.commit();
		
		response.sendRedirect( "poll.jsp" );
	}

    } 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", "/admin/poll/action.jsp");
    _caucho_line_map.add(10, 1);
    _caucho_line_map.add(1, 35);
    _caucho_line_map.add(10, 43);
    com.caucho.vfs.Depend depend;
    depend = new com.caucho.vfs.Depend(mergePath.lookup("file:/e:/jnjt/admin/poll/action.jsp"), 1030267321993L, 3576L);
    _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 + -