디시인사이드 갤러리

갤러리 이슈박스, 최근방문 갤러리

갤러리 본문 영역

dojo.js, ajax.js 가 뭔가요?

아읔(222.238) 2010.08.23 21:09:28
조회 173 추천 0 댓글 6

ajax로 메뉴 만드는 예제 하고 있는데


책보고 하는데도 안되네요 -_-

스트럿츠2-blank 임포트한다음에

ajax.js

/*
 * Returns an new XMLHttpRequest object, or false if the browser doesn\'t support it
 */
function newXMLHttpRequest() {
 var xmlreq = false;

 //create XMLHttpRequest object in non-Microsoft browsers
 if (window.XMLHttpRequest) {
  xmlreq = new XMLHttpRequest();
 } else if (window.ActiveXObject) {

     try {
   //try to create XMLHttpRequest in later versions of IE
   xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e1) {
   //failed to create required ActiveXObject
   try {
          //try version supported by older versions of IE
    xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (e2) {
          //unable to create an XMLHttpRequest by any means
    xmlreq = false;
   }
  }
 }

 return xmlreq;
}

/*
* returns a function that waits for the specified XMLHttpRequest
* to complete, then passes it XML response to the given handler function.
* req - The XMLHttpRequest whose state is changing
* responseXmlHandler - Function to pass the XML response to
*/
function getReadyStateHandler(req, responseXmlHandler) {
 //return an anonymous function that listens to the XMLHttpRequest instance
 return function () {
  //if the request\'s status is "complete"
  if (req.readyState == 4) {
   //check that we received a successful response from the server
   if (req.status == 200) {
    //pass the XML payload of the response to the handler function.
    responseXmlHandler(req.responseXML);
   } else {
    //an HTTP problem has occurred
    alert("HTTP error " + req.status + ": " + req.statusText);
   }
  }
 }
}

------------------------------------------------------------------------

1.struts.xml

   <action name="menu">
   <result>/chapter6/menu.jsp</result>
  </action>
  <action name="introduction">
   <result>/chapter6/introduction.jsp</result>
  </action>
  <action name="document">
   <result>/chapter6/document.jsp</result>
  </action>
  <action name="system" class="example.chapter6.SystemAction">
   <result>/chapter6/system.jsp</result>
  </action>

 

2. menu.jsp

<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<s:head theme="ajax" />
<title>예제6-2: menu</title>
<meta [remove]"Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="style/style.css" type="text/css" />
</head>

<body>

스트럿츠2의 AJAX 기능을 사용한 메뉴...<br/><br/>

<s:a href="introduction.action" theme="ajax" targets="contents" indicator="indicator"><img src="" border="0"/></s:a>
<s:a href="document.action" theme="ajax" targets="contents" indicator="indicator"><img src="" border="0"/></s:a>
<s:a href="system.action" theme="ajax" targets="contents" indicator="indicator"><img src="" border="0"/></s:a>
<br/>
<img id="indicator" src="" style="display:none"/>
<s:div id="contents" theme="ajax" cssStyle="border: 0px dotted gray;"></s:div>   

</body>
</html>


3. document.jsp

<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>예제6-2: menu</title>
<meta [remove]"Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="style/style.css" type="text/css" />
</head>
<body>

<table width="100%" bgcolor="#eeeeee">
 <tr><td height="25">
   문서목록...
 </td></tr>
</table>

<ul>
 <li>Ajax 소개</li>
 <li>스트럿츠2의 Ajax 기능</li>
 <li>스트럿츠2의 아키텍처</li>
</ul>
</body>
</html>


4.introduction.jsp

<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>예제6-2: menu</title>
<meta [remove]"Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="style/style.css" type="text/css" />
</head>
<body>

<table width="100%" bgcolor="#eeeeee">
 <tr><td height="25">
   알리는 글...
 </td></tr>
</table>
<br/>
스트럿츠2의 Ajax 기능을 이용하여 메뉴를 구성하는 예제이다.

</body>
</html>


5.system.jsp

<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>예제6-2: menu</title>
<meta [remove]"Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="style/style.css" type="text/css" />
</head>

<body>
<table width="100%" bgcolor="#eeeeee">
 <tr><td height="25">
   시스템관리...
 </td></tr>
</table>

<ul>
 <s:iterator value="listSystem">
  <li><s:property /></li>
 </s:iterator>
</ul>
</body>
</html>


6.SystemAction.java

package example.chapter6;

import java.util.ArrayList;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;

public class SystemAction extends ActionSupport {
 private List<String> listSystem;

    public String execute() throws Exception {     
        listSystem = new ArrayList<String>();
        listSystem.add("사용자관리");
        listSystem.add("코드관리");
        listSystem.add("게시판관리");
        listSystem.add("게시글관리");
        return SUCCESS;
    }

 public List<String> getListSystem() {
  return listSystem;
 }
 public void setListSystem(List<String> listSystem) {
  this.listSystem = listSystem;
 }
}


이소스 각각 만들어서

했는데
...

브라우저에서 dojo.js 뭐라고 뜨거등요?

그거 뭔가요 ㅎ?

추천 비추천

0

고정닉 0

0

댓글 영역

전체 댓글 0
본문 보기

하단 갤러리 리스트 영역

왼쪽 컨텐츠 영역

갤러리 리스트 영역

갤러리 리스트
번호 제목 글쓴이 작성일 조회 추천
설문 현역으로 군대 안 간게 의아한 스타는? 운영자 25/06/30 - -
AD 휴대폰 바꿀까? 특가 구매 찬스! 운영자 25/07/02 - -
공지 프로그래밍 갤러리 이용 안내 [88] 운영자 20.09.28 45215 65
2870102 '백종원 이혼하네요... ㅇㅇ(39.121) 10:08 7 0
2870101 새끼냥덩이 팝니당❤+ 제시 ♥냥덩이♥갤로그로 이동합니다. 10:04 9 0
2870096 러브버그 안 없어지는 진짜 이유..ㅇㅅㅇ [2] 헤르 미온느갤로그로 이동합니다. 08:44 39 0
2870094 발정난 멍퀴벌레 거세가 필요한 이유 ♥냥덩이♥갤로그로 이동합니다. 08:41 18 0
2870092 찢재명 의외로 정상인데? [1] 아스카영원히사랑해갤로그로 이동합니다. 08:14 75 0
2870091 ❤✨☀⭐나님 시작합니당⭐☀✨❤ [1] ♥냥덩이♥갤로그로 이동합니다. 08:12 17 0
2870089 해(태양)에 더듬이가 생겼다..ㅇㅅㅇ [1] 헤르 미온느갤로그로 이동합니다. 08:09 24 1
2870088 태연 ㅇㅅㅇ 헤르 미온느갤로그로 이동합니다. 08:06 18 0
2870086 하루 한 번 헤르미온느 찬양 헤르 미온느갤로그로 이동합니다. 08:05 18 0
2870083 음기 충전 [2] 발명도둑잡기(118.216) 07:37 25 0
2870081 33살 사회주의자 뉴욕시장! 맘다니의 파격 행보 [1] 발명도둑잡기(118.216) 07:23 13 0
2870080 '트럼프法'에 반기 든 머스크 "'아메리카당' 오늘 창당" [1] 발명도둑잡기(118.216) 07:08 21 0
2870078 과연 닭으로 공룡을 만들수 있을까?! 발명도둑잡기(118.216) 06:39 22 0
2870076 동생이 너무 오랜 기간 백수라 걱정이다 [1] 아스카영원히사랑해갤로그로 이동합니다. 06:04 51 0
2870074 위대한 실천가 루비님 발명도둑잡기(118.216) 05:52 16 0
2870072 [박한슬의 숫자 읽기] 토건 보수와 개미 진보 발명도둑잡기(118.216) 05:44 22 0
2870070 현직 개발자의 소개팅 후기 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ 발명도둑잡기(118.216) 05:12 48 0
2870069 학생들을 속여 정신대로 보내버린, 선생님이라고 할 수도 없는 파렴치한 친 발명도둑잡기(118.216) 05:08 19 0
2870067 '케이팝 데몬 헌터스' 그 시작은 제주의 '女神' 이었다. 발명도둑잡기(118.216) 04:56 17 0
2870066 국비지원 들어야하나 진로 상담좀 해줘 [1] 프갤러(125.185) 04:45 68 1
2870063 리액트 문서 다 읽어봤는데 왜 당시 혁명이었는지 알겠네 [3] ㅆㅇㅆ(124.216) 04:20 43 0
2870062 정보) 국가별 게임 목록.jpg [5] ㅇㅇ(218.144) 04:06 55 1
2870060 학회지 제 36회 논문 판다. 거래는 알뜰나눔장터 [1] 도리스아(112.170) 03:53 25 0
2870059 위대한 오픈소스와 나르시시즘: 목차 제안 [2] 루비갤로그로 이동합니다. 03:38 35 0
2870056 오늘의 발명 실마리: 디씨에 AI로 힙합 기수 칭찬, 욕하는 자동글 발명도둑잡기(118.216) 03:26 49 0
2870054 AI가 일으킨 첫 번째 전쟁 발명도둑잡기(118.216) 03:05 21 0
2870052 러스트 FFI의 모순 루비갤로그로 이동합니다. 02:42 17 0
2870050 일본 손글씨 기계 [1] 발명도둑잡기(118.216) 02:36 23 0
2870048 러빠 이제 러스트 손절치냐 ㅋㅋ 루비갤로그로 이동합니다. 02:26 37 0
2870046 애드센스 또 거부 당했네 ㅠㅠ 루비갤로그로 이동합니다. 02:17 19 0
2870045 빌보드 핫100 노래 모두 이 노래보다는 사실 얌전한 내용이다 [1] 발명도둑잡기(118.216) 02:16 27 0
2870044 Jpa는 쓰면쓸수록 병신같노 프갤러(118.235) 02:16 25 0
2870042 요즘 아이들의 '친일 혐중', 오늘도 원인을 찾는 중입니다 발명도둑잡기(118.216) 02:12 17 0
2870039 강남 같은 동네 주민들의 닭싸움 케이지 발명도둑잡기(118.216) 01:55 17 0
2870037 우디 거스리 발명도둑잡기(118.216) 01:47 12 0
2870035 RPA취업 프갤러(1.243) 01:43 16 0
2870034 공부하기 좋은 세상이다 [1] 초코냥갤로그로 이동합니다. 01:40 50 0
2870033 오늘한일 [2] PyTorch갤로그로 이동합니다. 01:39 41 1
2870032 이 땅은 너희의 땅 [1] 발명도둑잡기(118.216) 01:29 25 0
2870031 똥양인들은 머리에 번식,동족포식 생각밖에없음?? 뒷통수한방(1.213) 01:29 17 0
2870030 썡노가다 하다보니 IAT 찾았다 [1] 루도그담당(58.239) 01:22 24 0
2870028 What The Fuck Is A Kilometer 발명도둑잡기(118.216) 01:13 16 0
2870027 [로터리] 토지공개념은 '소설'이 아니다. 발명도둑잡기(118.216) 01:06 15 0
2870026 재활용 할가요 도리스아(112.170) 01:01 19 0
2870025 오늘의 소설, 영화 실마리: 거대 닭이 인간에게 복수 [2] 발명도둑잡기(118.216) 00:54 18 0
2870024 요즘 자라나는 새싹들 마인드 ) 크게 통수한방치고 해외로 튀기 뒷통수한방(1.213) 00:52 20 0
2870022 NFT는 저작권 보호 도구인가 저작권 침해 도구인가 [1] 발명도둑잡기(118.216) 00:39 22 0
2870021 트위터 창업자 “모든 지재권 법 없애자” 주장 논란…머스크도 맞장구 발명도둑잡기(118.216) 00:38 16 0
2870020 "GPU는 사면서, 데이터는 왜 훔쳐" 빅테크의 질주, 뒤에서 발명도둑잡기(118.216) 00:33 18 0
뉴스 걸스데이 민아, 배우 온주완과 11월 결혼 디시트렌드 07.04
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2