Your SlideShare is downloading. ×
Daejeon IT Developer Conference Web Service Practice
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Daejeon IT Developer Conference Web Service Practice

872
views

Published on

Daejeon IT Developer Conference Web Service Practice

Daejeon IT Developer Conference Web Service Practice

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
872
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 본 문서의 배포 및 변경 , 출력 및 활용에 관한 모든 권리는 작성자에 있습니다 . 본 서비스는 제 1 회 대전 IT 개발자 커뮤니티 참석자를 위해 제공됩니다 .
  • 2. 웹 서비스 개발 실습 심익찬 대전개발자커뮤니티 September 28 th , 2008
  • 3. 목차
    • Choice
    • Practical
    • Web Develope Environment
    • Before & After
    • Summary
  • 4. Choice
    • XDoclet
    Document Focus
    • Struts
    • Spring
    • Hibernate
    • iBATIS
    Framework Focus
    • Subversion
    • Bug
    Team Focus
    • Mantis
    • Builder
    • UI Tools
    Developement Focus Choice
  • 5. Practical Practical
  • 6. Web Develope Environment Tomcat 6 JDK 6 Windows XP Ant 1.7 Struts 2 Subversion Hibernate 3 Eclipse 3.4 iBATIS 2 or
    • Create Project
    • Make Source Folder
    • Configuration
    • web.xml
    • hibernate.cfg.xml
    • struts.xml
    • etc...
    개발 환경
  • 7. Web Develope Environment 프로젝트 소스 폴더 Xxx.hbm.xml hbm vo community net src project XxxService.java service community net src project IXxxService.java iface service community net src project XxxHibernateDao.java XxxIbatisDao.java persistence community net src project IXxxDao.java iface persistence community net src project ActionXxx.java action community net src project HibernateSessionFactory.java hibernate common community net src project Struts2Dispatcher.java filter common community net src project hibernate.cfg.xml struts.xml struts.properties message.properties project web.xml WEB-INF WebContent project Xxx.java vo community net src project Step 5 Step 4 Step 3 Step 2 Step 7 Step 6 Step 1
  • 8. Practical
    • Eclipse IDE
    프로젝트 소스 폴더 (Eclipse IDE)
  • 9. Practical
    • Eclipse IDE
    프로젝트 소스 폴더 (Eclipse IDE)
  • 10. Practical <filter> <filter-name>struts2</filter-name> <filter-class> type.company.common.filter.Struts2Dispatcher </filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> web.xml
  • 11. Practical <?xml version= '1.0' encoding= 'utf-8' ?> <!DOCTYPE hibernate-configuration PUBLIC &quot;-//Hibernate/Hibernate Configuration DTD//EN&quot; &quot;http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd&quot;> <hibernate-configuration> <session-factory> <!-- <property name=&quot;connection.driver_class&quot;> com.mysql.jdbc.Driver </property> <property name=&quot;connection.url&quot;> jdbc:mysql://localhost:3306/community </property> <property name=&quot;connection.username&quot;> root </property> <property name=&quot;connection.password&quot;> mysql </property> <property name=&quot;dialect&quot;> org.hibernate.dialect.MySQLDialect </property> --> hibernate.cfg.xml
  • 12. Practical <property name= &quot;hibernate.connection.datasource&quot; > java:/comp/env/jdbc/community </property> <property name= &quot;hibernate.show_sql&quot; > true </property> <property name= &quot;hibernate.format_sql&quot; > true </property> <property name= &quot;connection.useUnicode&quot; > true </property> <property name= &quot;connection.characterEncoding&quot; > utf8 </property> <property name= &quot;current_session_context_class&quot; > thread </property> <property name= &quot;hibernate.transaction.factory_class&quot; > org.hibernate.transaction.JDBCTransactionFactory </property> <mapping resource= &quot; type/company/vo/hbm/User.hbm.xml &quot; /> </session-factory> </hibernate-configuration> 정보 : Starting Servlet Engine: Apache Tomcat/6.0.16 AbandonedObjectPool is used (org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool@14d1d41) LogAbandoned: true RemoveAbandoned: true RemoveAbandonedTimeout: 60 hibernate.cfg.xml
  • 13. Practical <?xml version= &quot;1.0&quot; encoding= &quot;UTF-8&quot; ?> <!DOCTYPE struts PUBLIC &quot;-//Apache Software Foundation//DTD Struts Configuration 2.0//EN&quot; &quot;http://struts.apache.org/dtds/struts-2.0.dtd&quot;> <struts> <package name= &quot; struts2 &quot; extends= &quot; struts-default &quot; > </package> </struts> struts.xml
  • 14. Before & After
    • VO (Value Object) or Domain
    • public class User implements Serializable {
    • private int userNumber; // 회원 번호
    • private String userId; // 회원 ID
    • private String userPassword; // 회원 비밀번호
    • private String koreaName; // 회원 성명 ( 한글 )
    • private String englishName; // 회원 성명 ( 영문 )
    • private String emailAddress; // 이메일 주소
    • private String messengerAddress; // 메신저 주소
    • private String phoneNumber; // 전화 번호
    • ....
    • }
    VO
  • 15. Before & After
    • hbm.xml
    • <?xml version= &quot;1.0&quot; ?>
    • <!DOCTYPE hibernate-mapping PUBLIC &quot;-//Hibernate/Hibernate Mapping DTD 3.0//EN&quot;
    • &quot;http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd&quot;>
    • <hibernate-mapping>
    • <class name= &quot; type.company.vo.User &quot; table= &quot; user &quot; >
    • <id name= &quot;userNumber&quot; type= &quot;int&quot; column= &quot;user_number&quot; length= &quot;10&quot; >
    • <generator class= &quot;identity&quot; />
    • </id>
    • <property name= &quot;userId&quot; type= &quot;string&quot; column= &quot;user_id“ length= &quot;40&quot; />
    • <property name= &quot;userPassword&quot; type= &quot;string“ column= &quot;user_password&quot; length= &quot;40&quot; />
    • <property name= &quot;koreaName&quot; type= &quot;string&quot; column= &quot;korea_name&quot; length= &quot;60&quot; />
    • <property name= &quot;englishName&quot; type= &quot;string&quot; column= &quot;english_name&quot; length= &quot;60&quot; />
    • ...
    hbm.xml
  • 16. Before & After
    • iface
    • public interface IUcujucDao {
    • // 인원 가입 정보 관리 ( 입력 )
    • public void ucujucc(User user);
    • // 인원 가입 정보 관리 ( 조회 )
    • public User ucujucr(int userNumber);
    • // 인원 가입 정보 관리 ( 검색 )
    • public List<User> ucujucrs(int userNumber);
    • // 인원 가입 정보 관리 ( 수정 )
    • public void ucujucu(User user);
    • // 인원 가입 정보 관리 ( 삭제 )
    • public void ucujucd(int userNumber);
    • }
    Persistence
  • 17. Before & After
    • dao (Select)
    • private User ucujuc;
    • // 인원 가입 정보 관리 ( 조회 )
    • public void ucujucc(User user) {
    • Session session = HibernateSessionFactory. getSession ();
    • Transaction transaction = null;
    • try {
    • session.beginTransaction();
    • Query query = session.createQuery(&quot;from User as user &quot;
    • + &quot;left join fetch user.userRankType as userRankType &quot;
    • + &quot;left join fetch user.organizationDivision as organizationDivision &quot;
    • + &quot;left join fetch user.organization as organization &quot;
    • + &quot;left join fetch user.company as company &quot;
    • + &quot;where user.userNumber = :userNumber&quot;);
    • query.setInteger(&quot;userNumber&quot;, userNumber);
    • return (User) query.uniqueResult();
    • } catch (RuntimeException e) {
    • if (transaction != null) {
    • transaction.rollback();
    • }
    • throw e;
    • ...
    Persistence
  • 18. Before & After
    • dao (Insert)
    • private User ucujuc;
    • // 인원 가입 정보 관리 ( 입력 )
    • public void ucujucc(User user) {
    • Session session = HibernateSessionFactory. getSession ();
    • Transaction transaction = null;
    • try {
    • transaction = session.beginTransaction();
    • session.save(user);
    • transaction.commit();
    • } catch (RuntimeException e) {
    • if (transaction != null) {
    • transaction.rollback();
    • }
    • throw e;
    • } finally {
    • session.close();
    • }
    • ...
    Persistence
  • 19. Before & After
    • dao (Update)
    • private User ucujuc;
    • // 인원 가입 정보 관리 ( 수정 )
    • public void ucujucc(User user) {
    • Session session = HibernateSessionFactory. getSession ();
    • Transaction transaction = null;
    • try {
    • transaction = session.beginTransaction();
    • session.update(user);
    • transaction.commit();
    • } catch (RuntimeException e) {
    • if (transaction != null) {
    • transaction.rollback();
    • }
    • throw e;
    • } finally {
    • session.close();
    • }
    • ...
    Persistence
  • 20. Before & After
    • dao (Delete)
    • private User ucujuc;
    • // 인원 가입 정보 관리 ( 삭제 )
    • public void ucujucc(User user) {
    • Session session = HibernateSessionFactory. getSession ();
    • Transaction transaction = null;
    • try {
    • transaction = session.beginTransaction();
    • ucujuc = (User) session.get(User.class, userNumber);
    • session.delete(ucujuc);
    • } catch (RuntimeException e) {
    • if (transaction != null) {
    • transaction.rollback();
    • }
    • throw e;
    • } finally {
    • session.close();
    • }
    • ...
    Persistence
  • 21. Before & After
    • iface
    • public interface IUcujucService {
    • // 인원 가입 정보 관리 ( 입력 )
    • public void ucujucc(User user);
    • // 인원 가입 정보 관리 ( 조회 )
    • public User ucujucr(int userNumber);
    • // 인원 가입 정보 관리 ( 검색 )
    • public List<User> ucujucrs(int userNumber);
    • // 인원 가입 정보 관리 ( 수정 )
    • public void ucujucu(User user);
    • // 인원 가입 정보 관리 ( 삭제 )
    • public void ucujucd(int userNumber);
    • }
    Service
  • 22. Before & After
    • service
    • public UcujucService() {
    • this.ucujucDao = new UcujucHibernateDao();
    • }
    • // 인원 가입 정보 관리 ( 입력 )
    • public void ucujucc(User user) {
    • ucujucDao.ucujucc(user);
    • }
    • // 인원 가입 정보 관리 ( 조회 )
    • public User ucujucr(int userNumber) {
    • return ucujucDao.ucujucr(userNumber);
    • }
    • // 인원 가입 정보 관리 ( 수정 )
    • public void ucujucu(User user) {
    • ucujucDao.ucujucu(user);
    • }
    • // 인원 가입 정보 관리 ( 삭제 )
    • public void ucujucd(int userNumber) {
    • ucujucDao.ucujucd(userNumber);
    • }
    Service
  • 23. Before & After <action name= &quot;ucualcrf&quot; method= &quot;ucualcrf“ class= &quot;type.company.action.uc.ua.UcualcAction&quot; > <result name= &quot;success&quot; > /uc/ua/lc/ucualcrf.jsp</ result> </action> <action name= &quot;ucualcrs&quot; method= &quot;ucualcrs&quot; class= &quot;type.company.action.uc.ua.UcualcAction&quot; > <result name= &quot;success &quot;> /uc/ua/lc/ucualcr.jsp </result> <result name= &quot;input &quot;> /uc/ua/lc/ucualcrf.jsp </result> </action> <action name= &quot;ucujucc&quot; method= &quot;ucujucc&quot; class= &quot;type.company.action.uc.uj.UcujucAction&quot; > <result name= &quot;success&quot; type= &quot;redirect-action&quot; > ucujusrList </result> <result name= &quot;input&quot; type= &quot;chain&quot; > ucujuccf </result> </action> <action name= &quot;ucujucr&quot; method= &quot;ucujucr&quot; class= &quot;type.company.action.uc.uj.UcujucAction&quot; > <result name= &quot;success &quot;>/uc/uj/uc/ucujucr.jsp </result> </action> struts.xml
  • 24. 영상
  • 25. 감사합니다 .

×