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

📄 noteindex.java

📁 留言簿架构 oracle 9i + jsp + struts 留言簿基本功能: 1 、客人签写留言 2 、基本的UBB支持
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.guestbook.action.admin;

import com.guestbook.sys.*;

import oracle.sql.*;
import oracle.jdbc.driver.*;

import java.sql.*;
import java.util.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;


import java.io.IOException;
import java.io.PrintWriter;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** 
 * MyEclipse Struts
 * Creation date: 09-19-2007
 * 
 * XDoclet definition:
 * @struts.action validate="true"
 * @struts.action-forward name="/admin/noteindex" path="/ddd"
 */
public class noteindex extends Action {
	/*
	 * Generated Methods
	 */

	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	
	private static Log logger=LogFactory.getLog(noteindex.class);
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		// TODO Auto-generated method stub
		
		if( request.getSession().getAttribute( "loginSuccess" ) == null )
		{
			return mapping.findForward( "notLogin" );
		}
		try
		{
			//Hashtable hashtable=new Hashtable();
			 //hashtable.put("title", "title");
			// hashtable.put("guestcontent","guestcontent"); 
		request.setAttribute( "dynamicParameter", SysInfo.getInstance().getDynamicParameter() );
		request.setAttribute("notes", getNotes() );
		
		//request.setAttribute("notes", hashtable );
		}catch(Exception ex){
			logger.error(" equest.setAttribute(\"notes\", getNotes()  ERROR!");
			logger.error(ex.getMessage());
		}
		return mapping.findForward("/admin/noteindex");
	} 
	
	
	private String getClob(Clob clob) throws SQLException{
		if(clob!=null)
		  return clob.getSubString(((long)1),((int)(clob.length())));
		return "";
	}
	private Hashtable getNotes() throws SQLException,ClassNotFoundException{
		Hashtable hashtable=new Hashtable();
		Connection con=DataBaseConnection.getConnection();
		CallableStatement stmt=con.prepareCall("{  call pkg_guestadmin.p_getbulletininfo(?) }");
		ResultSet rs;
		
		try
		{
			 
			 stmt.registerOutParameter(1,OracleTypes.CURSOR);
			 stmt.execute();
			 rs=((OracleCallableStatement) stmt).getCursor(1);
			 ResultSetMetaData rsmd=rs.getMetaData();
			 if(rs.next()){
				 hashtable.put("title", (rs.getObject(1)!=null)?rs.getObject(1).toString():"");
				 hashtable.put("guestcontent",getClob(rs.getClob(2))); 
			 } 
			 stmt.close();
			 con.close(); 
		}
		catch(Exception ex){
			logger.error("noteindex LoadData ERROR!");
			logger.error(ex.getMessage());
		} 
		return hashtable;
		
	}
}

⌨️ 快捷键说明

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