디시인사이드 갤러리

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

갤러리 본문 영역

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

아읔(222.238) 2010.08.23 21:09:28
조회 167 추천 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 http-equiv="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 http-equiv="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 http-equiv="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 http-equiv="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
등록순정렬 기준선택
본문 보기

하단 갤러리 리스트 영역

왼쪽 컨텐츠 영역

갤러리 리스트 영역

갤러리 리스트
번호 제목 글쓴이 작성일 조회 추천
설문 비난 여론에도 뻔뻔하게 잘 살 것 같은 스타는? 운영자 24/06/03 - -
공지 프로그래밍 갤러리 이용 안내 [71] 운영자 20.09.28 35358 62
2709309 비가와서 그런지 멍청한유라ㅋ갤로그로 이동합니다. 11:05 1 0
2709308 20~25년 전엔가 일기에 미라지인가 미라쥬라는 발명도둑잡기갤로그로 이동합니다. 10:58 5 0
2709307 아 ccna가 영어 시험 밖에 없는 시험이었구나 망했네 [1] 프갤러(180.64) 10:57 2 0
2709306 빡머갈이라 네트워크 보안이나 해야겠다 [2] 덴분갤로그로 이동합니다. 10:49 20 0
2709305 까치가 걸어다니네양 [1] ♥여래신장냥덩♥갤로그로 이동합니다. 10:46 8 1
2709304 4050 좌파들은 범죄자도태세대 ♥여래신장냥덩♥갤로그로 이동합니다. 10:40 6 0
2709303 직장 50대 한국아재의 20대 일본여자 성희롱.. 프로외노자갤로그로 이동합니다. 10:38 14 0
2709302 + 저 진짜 사소한 고민 있어요 qu(121.171) 10:37 14 0
2709300 리눅스 이거 어케쓰냐 [1] 덴분갤로그로 이동합니다. 10:35 20 0
2709299 컴퓨터를 살까말까 계속 고민만 하는 중이다... 이제 지긋지긋하다 [1] ㅇㅇ(223.38) 10:29 13 1
2709298 우울하다..ㅇㅅㅇ [1] 헤르 미온느갤로그로 이동합니다. 10:27 10 0
2709297 vscode에서 코드 폴딩 꼬이는거 어떻게 하냐?? [2] 프갤러(112.162) 10:24 10 0
2709296 방금 전 인스타그램 추천 발명도둑잡기갤로그로 이동합니다. 10:13 16 0
2709295 잡코는 거의 하청파견 뺑뺑이 좃소임 [3] 클갤(39.7) 10:05 27 0
2709294 ㅇㅅㅇ ♥여래신장냥덩♥갤로그로 이동합니다. 10:04 13 0
2709292 취업하고싶다 [1] ㅇㅇ(106.102) 10:01 25 0
2709291 포케로그 개재밌는데 타입스크립트갤로그로 이동합니다. 10:00 8 0
2709290 걍 질렀음 ㅇㅇ(211.234) 09:59 13 0
2709289 모닝 알고리즘 풀엇읍니다 피에로가르뎅갤로그로 이동합니다. 09:55 16 0
2709288 옛날 젠폰에서 고장난 유심이랑 현재폰 유심이 듀얼심이되다니... 도리스아(119.195) 09:51 7 0
2709286 은행은 160개나 있네 [2] 버거띠갤로그로 이동합니다. 09:37 40 0
2709285 증권으로 검색해도 72개나 있네 [1] 버거띠갤로그로 이동합니다. 09:35 24 0
2709284 잡코리아 가니까 웹개발자 2천개 있는데 [1] 버거띠갤로그로 이동합니다. 09:33 57 1
2709283 전원 모드 바꾸는거 만들었음 ㅇㅇ(122.199) 09:31 26 0
2709282 전 여친이 자꾸 스토킹함.txt [1] Kyle(120.17) 09:30 33 0
2709281 닭장암컷 약간 발정수컷 같은 어감임 딱국(118.235) 09:29 14 0
2709280 닭장이라고하면 진짜 개꼴리네 딱국(118.235) 09:28 20 0
2709279 나라장터 물건 보는 재미 나라장터쇼핑몰 일반인도 구매가능 도리스아(119.195) 09:25 12 0
2709278 비가 많이 온다. 나 에전에 집이 떠내려가는 꿈 꾸었는데 어디 안 나가야 [3] 도리스아(119.195) 09:16 16 0
2709277 죽엇!! 죽어엇!! ♥여래신장냥덩♥갤로그로 이동합니다. 09:11 17 0
2709276 검찰이 최근 조현옥 전 청와대 인사수석을 압수수색했습니다. 전주지검 형 검찰이 최근 조현옥 전 청와대 인사수(211.40) 09:04 16 0
2709275 현직 경찰관 B씨 강제추행 혐의로 불구속기소 된 A(54)씨에게 징역 1 현직 경찰관 B씨 강제추행 혐의로 불(211.40) 08:57 20 0
2709274 AI는 왜 벡터연산을 해야 하나? [2] ㅇㅇ(114.30) 08:50 30 0
2709273 하루 한 번 헤르미온느 찬양 헤르 미온느갤로그로 이동합니다. 08:30 24 0
2709272 5G NR 모드 기본 사용 내 폰 5G 되는거 아님? 도리스아(119.195) 08:23 12 0
2709271 트류미 히히 ㅇㅅㅇ [4] 나트륨찡갤로그로 이동합니다. 08:22 32 0
2709270 님 노트 8 제 폰 중고가 예상 가치좀. 도리스아(119.195) 08:15 17 0
2709268 따구기 히히 [1] 딱국(61.99) 08:04 32 0
2709267 운동을 하고 그래야 하는데 [2] 주아갤로그로 이동합니다. 07:56 32 1
2709266 망갤 테스트 [4] 나트륨찡갤로그로 이동합니다. 05:55 66 3
2709263 일본에서 노트 8 팔릴까요? [4] 도리스아(119.195) 04:32 37 0
2709262 시발 갤 망햇노 [1] 프갤러(180.71) 04:28 55 0
2709259 kmooc급 찾았노 [2] 덴분갤로그로 이동합니다. 03:52 70 2
2709258 딱국이 이쁜여자랑 눈마주치면 ㄹㅇ 고양이앞의 생쥐 딱국(61.99) 03:46 21 0
2709257 전라도차별?ㅋㅋ그럼북한욕하면북한차별이냐?졷같으니까뭐라하는건데 보법E노무현갤로그로 이동합니다. 03:46 23 0
2709256 솔직히 딱국 부럽징? 섹스밖에 모르는거 히히 [1] 딱국(61.99) 03:44 40 0
2709255 아 이쁜여자가 뭐라고 이렇게나 좋은걸까 딱국(61.99) 03:39 20 0
2709254 너희들은 딱국이 보면 무슨생각들어? 딱국(61.99) 03:37 23 0
2709253 나 진짜 자해수준으로 번식올인하고있음... 딱국(61.99) 03:30 28 0
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2