struts-config.xml을 먼저 올리겠습니다.
오라클자바커뮤니티에서 설립한 오엔제이프로그래밍 실무교육센터
(오라클SQL, 튜닝, 힌트,자바프레임워크, 안드로이드, 아이폰, 닷넷 실무전문 강의)
///////////////// struts-config.xml //////////////////////////////////
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<!-- ========== Form Bean Definitions ================================== -->
<form-beans>
<!-- =================================================== -->
<!-- =======================login======================= -->
<!-- =================================================== -->
<form-bean name="LoginForm" type="login.model.LoginForm"/>
</form-beans>
<!-- ========== Global Forward Definitions =============================== -->
<global-forwards>
<!-- =================================================== -->
<!-- =======================login======================= -->
<!-- =================================================== -->
<forward name="login_success" path="/login/login_success.jsp" />
<forward name="login_fail" path="/login/login_fail.jsp" />
<forward name="logout" path="/login/logout.jsp" />
<!-- =================================================== -->
<!-- ======================board======================== -->
<!-- =================================================== -->
<forward name="board_list" path="/board/board_list.jsp" />
<forward name="search_action_success" path="/board/search_action_success.jsp" />
<forward name="board_view" path="/board/board_view.jsp" />
<forward name="board_process_success" path="/board/process_success.jsp" />
<forward name="board_process_fail" path="/board/process_fail.jsp" />
</global-forwards>
<!-- ========== Action Mapping Definitions =============================== -->
<action-mappings>
<!-- =================================================== -->
<!-- =======================login======================= -->
<!-- =================================================== -->
<action
path="/log/log_form"
type="login.action.LogFormAction"
name="LoginForm"
validate="false">
</action>
<action
path="/log/log_link"
type="login.action.LogLinkAction">
</action>
</action-mappings>
</struts-config>
////////// LoginForm.java ///////////////////////////////////////
package login.model;
import org.apache.struts.action.ActionForm;
public class LoginForm extends ActionForm {
protected String member_id;
protected String member_password;
protected String action;
/**
* @return Returns the member_id.
*/
public String getMember_id() {
return member_id;
}
/**
* @param member_id The member_id to set.
*/
public void setMember_id(String member_id) {
this.member_id = member_id;
}
/**
* @return Returns the member_password.
*/
public String getMember_password() {
return member_password;
}
/**
* @param member_password The member_password to set.
*/
public void setMember_password(String member_password) {
this.member_password = member_password;
}
/**
* @return Returns the action.
*/
public String getAction() {
return action;
}
/**
* @param action The action to set.
*/
public void setAction(String action) {
this.action = action;
}
}
//////////////////// LoginDAO.java ////////////////////////////////
package login.model;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.DriverManager;
import com.bitmechanic.sql.ConnectionPoolManager;
import multiboard.KKJLog;
import login.model.MemberVO;
public class LoginDAO
{
Connection con=null;
PreparedStatement pstmt=null;
ResultSet rs = null;
String sql = "";
/*
* 개요 : 사용자 인증
* 작성일 : 2005-08-05
* 작성자 : 김길재
* 수정자 :
*/
public MemberVO authUser( String member_id , String member_password )
{
try
{
con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
int count = 0;
sql = " SELECT MEMBER_NAME , MEMBER_LEVEL ";
sql += " FROM MEMBER ";
sql += " WHERE MEMBER_ID = ? AND MEMBER_PASSWORD = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setString( 1 , member_id );
pstmt.setString( 2 , member_password );
rs = pstmt.executeQuery();
if( rs.next() )
{
MemberVO member = new MemberVO();
member.setMember_id( member_id );
member.setMember_password( member_password );
member.setMember_name( rs.getString( "MEMBER_NAME" ) );
member.setMember_level( Integer.toString( rs.getInt( "MEMBER_LEVEL" ) ) );
return member;
}
else
{
return null;
}
}
catch( Exception e )
{
try
{
con.rollback();
}
catch( Exception e1 )
{}
KKJLog.info( "//////////////////////////////////////////////" );
KKJLog.info( "authUser Error : " + e.toString() );
KKJLog.info( "//////////////////////////////////////////////" );
return null;
}
finally
{
try
{
if ( rs != null )
rs.close();
if ( pstmt != null )
pstmt.close();
if ( con != null )
con.close();
}
catch ( Exception ignore )
{
}
}
}
}
///////////// MemberVO.java /////////////////////////////////////]
package login.model;
public class MemberVO
{
private String member_id = null;
private String member_password = null;
private String member_name = null;
private String member_level = null;
/**
* @return Returns the member_level.
*/
public String getMember_level() {
return member_level;
}
/**
* @param member_level The member_level to set.
*/
public void setMember_level(String member_level) {
this.member_level = member_level;
}
/**
* @return Returns the member_id.
*/
public String getMember_id() {
return member_id;
}
/**
* @param member_id The member_id to set.
*/
public void setMember_id(String member_id) {
this.member_id = member_id;
}
/**
* @return Returns the member_name.
*/
public String getMember_name() {
return member_name;
}
/**
* @param member_name The member_name to set.
*/
public void setMember_name(String member_name) {
this.member_name = member_name;
}
/**
* @return Returns the member_password.
*/
public String getMember_password() {
return member_password;
}
/**
* @param member_password The member_password to set.
*/
public void setMember_password(String member_password) {
this.member_password = member_password;
}
}
댓글 없음:
댓글 쓰기