본문 바로가기

STUDY/STRUTS7

struts2를 이용한 간단한 데이터 전송 데이터 전송방법 1 ① Action○ DTO + method - dto랑 메소드를 같이 생성하여 관리 ○ ActionSupprot를 상속받아 사용○ 내장 변수 - SUCCESS : "success" - INPUT : "input"package com.test; import com.opensymphony.xwork2.ActionSupport; public class TestAction extends ActionSupport{private static final long serialVersionUID = 1L;private String userId;private String userName;private String message;public String getUserId() {return userId;}p.. 2019. 3. 22.
Struct1 + iBatis 게시판(4) 5. 게시물 수정(update)○ updatd.jsp 파일을 만들지 않고 created.jsp파일만 사용하여 상황에 따라 create/update를 사용 - 주소창에 mode라는 값을 넘겨준다 - mode가 save일 때는 입력 : 시작점 리스트(list.jsp)화면 - mode가 updateok일 때는 수정 : 시작점 게시물(article.jsp)화면 5-1 created 메소드 수정○ create메소드를 찾아가는 경우 - list화면에서 글 올리기 클릭 시 → mode값을 넘겨주지 않는다(null) - article화면에서 수정하기 클릭시 → mode값은 updatepublic ActionForward created(ActionMapping mapping, ActionForm form,HttpServ.. 2019. 3. 21.
Struct1 + iBatis 게시판(3) 4. article 작성(게시글 보기) 4-1 boardTest_sqlMpa.xml 작성○ 이전글 / 다음글 기능 - 클릭한 번호에서 이전글은 클릭한 번호보다 큰 데이터를 ASC로 정렬 다음글은 클릭한 번호보다 작은 데이터를 DESC로 정렬 후, 맨 처음 하나를 가져온다 select num,name,subject,email,pwd,content,ipAddr,hitCount,createdfrom board where num=#num# select data.* from (select num,subject from boardwhere ($searchKey$ like '%' || #searchValue# || '%')and (num>#num#) order by num asc) datawhere rownum=1 2019. 3. 20.
Struct1 + iBatis 게시판(2) 3. list 3-1. list.jsp 작성① script부분function searchData() {var f = document.searchForm;f.action = "/boardTest.do?method=list";f.submit();} ② body 부분 게 시 판(Struts1 + iBatis)제목이름내용번호제목작성자작성일조회수${dto.num }${dto.subject }${dto.name }${dto.created }${dto.hitCount }${pageIndexList }등록된 게시물이 없습니다. 3-2. BoardAction.java 작성① boardTest_sqlMap.xml 작성○ resultClass : 반환값 변수형○ parameterClass : 필요한 변수 형○ - 대괄호 안.. 2019. 3. 20.
Struct1 + iBatis 게시판(1) 0. 필요한 파일 확인 ○ BoardAction.java○ BoardForm.java ○ CommonDAO.java○ CommonDAOImpl.java ○ SqlMapConfig.java○ boardTest_sqlMap.xml○ sqlMapConfig.xml ○ article.jsp○ created.jsp○ list.jsp ○ struts-config_boardTest,xml○ struts-config.xml 1-1. 사전작업① web.xml에서 /WEB-INF/struts-config_boardTest.xml 추가 action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml, /WEB-INF/struts-config_te.. 2019. 3. 20.
Struct 프로젝트 예제 1. web.xml/WEB-INF/struts-config_test.xml 추가 action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml, /WEB-INF/struts-config_temp.xml, /WEB-INF/struts-config_test.xml 2 action *.do 2. com.test > TestForm TestForm : DTO○ ActionForm을 상속받기 때문에 Form이라고 이름을 생성○ 나중에는 편의상 DTO로 작성○ DTO를 Struct가 관리한다.package com.test;import org.apache.struts.action.ActionForm; public class TestFor.. 2019. 3. 18.
프레임워크 - Struts 프레임워크의 종류1. Struts2. Hibernate : 유럽에서 주로 사용3. iBatis(2.0) → MyBatis(3.0) (데이터베이스의 프레임워크) - iBatis : Struts - MyBatis : Spring4. Rails : 많이 사용하지 않는다5. Struts2 (Struts와 아무관계 없다)6. SpringStruts는 요즘 회사에서 사용하지 않는다 Struts 다운로드○ 홈페이지 : https://struts.apache.org/ ○ struts-1.3.10-all.zip 다운로드○ iBatis ibatis-2.3.4.726.zip Struts프로젝트 생성 1. Dynamic Web Project생성 ▶ Generate web.xml deployment descriptor 체크 2.. 2019. 3. 18.