leavewordsave.java

来自「留言簿架构 oracle 9i + jsp + struts 留言」· Java 代码 · 共 64 行

JAVA
64
字号
package com.guestbook.action;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.*;

import javax.servlet.http.*;

import java.sql.*;
import java.util.*;
import javax.servlet.*;
import java.io.*;
import oracle.sql.CLOB;

import com.guestbook.sys.DataBaseUtil;
import com.guestbook.sys.DataBaseConnection;
import com.guestbook.sys.SysInfo;
import com.guestbook.form.*;

public class LeaveWordSave extends Action
{
	private static final Log logger = LogFactory.getLog( LeaveWordSave.class );
	
	public ActionForward execute(ActionMapping actionMapping,
            ActionForm actionForm,
            HttpServletRequest request,
            HttpServletResponse httpServletResponse)
	{
		LeaveWordForm form = ( LeaveWordForm ) actionForm;
		form.setIp( request.getRemoteAddr() );
		
		AddLeaveWord( form );
 
		return actionMapping.findForward( "/index" );
	}
	
	private void AddLeaveWord( LeaveWordForm form )
	{
		try
		{
			Connection conn = DataBaseConnection.getConnection();
			CallableStatement cstm = conn.prepareCall( "{call pkg_guestInfo.p_guestInfo_Add(?,?,?,?,?,?,?,?,?,?)}" );
			cstm.setString( 1 , form.getGuestname() );		//in_guestname
			cstm.setString( 2 , form.getComefrom() );		//in_comefrom
			cstm.setString( 3 , form.getComefromCity() );	//in_comefromCity
			cstm.setString( 4 , form.getFace() );			//in_face
			cstm.setString( 5 , form.getGuestcontent() );		//in_guestcontent
			cstm.setString( 6 , form.getOicq() );			//in_oicq
			cstm.setString( 7 , form.getEmail() );			//in_email
			cstm.setString( 8 , form.getHomepage() );		//in_homepage.
			cstm.setString( 9 , form.getIp() );				//in_ip
			cstm.setByte( 10 , form.getSecretly() );		//in_secretly

			cstm.execute();
			cstm.close();
			conn.close();
		}
		catch( Exception exp )
		{
			logger.error( exp );
		}
	}
}

⌨️ 快捷键说明

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