디시인사이드 갤러리

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

갤러리 본문 영역

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

아읔(222.238) 2010.08.23 21:09:28
조회 166 추천 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 - -
215874 맨투맨 교육받기로 했다 [1] .3(124.137) 10.11.04 86 0
215873 여자친구 사귀는 애들은 조심해라. [7] 물속의다이아갤로그로 이동합니다. 10.11.04 188 0
215872 아무리 봐도 쥐그림 정말 잘 그리지 않았냐? [2] 물속의다이아갤로그로 이동합니다. 10.11.04 123 0
215871 참 이상해.. 코딩이라는거는 어려워... [2] rntjr갤로그로 이동합니다. 10.11.04 105 0
215869 5분안에 이문제좀 풀어줘 횽들 급해 ㅠ [1] Qdd(137.49) 10.11.04 107 0
215868 OOP 다음 세대의 언어는 모가 나올까염 [3] 홍어(58.180) 10.11.04 124 0
215867 횽들 어떤 조공 좋아라함? [2] 불쾌지수(175.200) 10.11.04 119 0
215866 api질문임 [1] 읭읭읭읭갤로그로 이동합니다. 10.11.04 57 0
215865 스프링 좀 하시는 분 계신지요? 허허이것참(202.31) 10.11.04 67 0
215863 소스 다 올려볼게여 - -; [3] ㅇㅇ(58.121) 10.11.04 93 0
215861 이중링크드리스트 역순배열 함수 만들어봤는데 뭐가 문젤까요 ㅠㅠ [1] ㅇㅇ(58.121) 10.11.04 281 0
215860 DB책좀 추천 해봐라 [1] (175.113) 10.11.04 95 0
215858 도와주십쇼는 봅니다 [1] cyluss갤로그로 이동합니다. 10.11.04 64 0
215856 도트디자인 외주 써보신분 계시나요? ㅎㄷ(121.165) 10.11.04 52 0
215855 ㅎㄷ형 팁좀 주세용 [2] 도와주십쇼(119.197) 10.11.04 69 0
215854 횽들 포인터 형변환좀 가르쳐 주십쇼 [9] c언어(121.151) 10.11.04 126 0
215853 api 질문임요 [7] 읭읭읭읭갤로그로 이동합니다. 10.11.04 86 0
215852 형님들 질문좀하겠습니다 [10] 도와주십쇼(119.197) 10.11.04 101 0
215850 늅E 고마워횽들 욕해서 미안해. 늅E(218.154) 10.11.03 36 0
215848 갤럭시S, 日 시장서 아이폰 `추월'…판매량 1위 [3] .3(203.223) 10.11.03 169 0
215844 이거 왜 이런건가요 ㅠㅠ 엉엉. [4] 와우,갤로그로 이동합니다. 10.11.03 93 0
215843 MS사 불법 윈도우 운영중인 PC방 무더기 고소 [6] 우루곰(180.228) 10.11.03 189 0
215842 int DCinside(char* k)에서............ [3] 이런된장(121.129) 10.11.03 55 0
215841 안드로이드든 아이폰이든 윈모뱔이든 결국은 [1] 홍어(58.180) 10.11.03 77 0
215840 안드로이드는 정말 망할 것 같다 [3] 거븍아(125.53) 10.11.03 209 0
215839 성공과 실패를 결정하는 1%의 객체지향원리 [1] 홍어(58.180) 10.11.03 103 0
215838 api 잠시만 Dialog 관한거 [10] !ㅂㅈㄷㄱ갤로그로 이동합니다. 10.11.03 91 0
215837 떡밥이 필요해??? 떡밥 좋아. 내가 떡밥 선도자가 되도록하지. [3] 초밥술사갤로그로 이동합니다. 10.11.03 77 0
215836 떡밥 좀 주세요. [8] 신종플루크갤로그로 이동합니다. 10.11.03 145 0
215835 [C]파일에서 읽어올 때... ㄴㄴ(220.69) 10.11.03 48 0
215834 떡밥좀 줘 [12] cyluss갤로그로 이동합니다. 10.11.03 121 0
215833 이나영같은 스타일 좋지 않음?? [8] 초밥술사갤로그로 이동합니다. 10.11.03 155 0
215832 어딜 튀려고 [5] cyluss갤로그로 이동합니다. 10.11.03 122 0
215830 관대한 40! [3] ㅇㅇㅃ갤로그로 이동합니다. 10.11.03 115 0
215827 내 컴터가 이상해... [2] 아주아슬갤로그로 이동합니다. 10.11.03 52 0
215826 나가면 돈이네 [3] 이모군(1.225) 10.11.03 80 0
215823 횽들 포인터형변환에 대해 물어봐도 될까요? [2] 포인터(165.229) 10.11.03 88 0
215821 형님들 40!코딩 [10] 40!(121.137) 10.11.03 263 0
215820 아...책임자 라는 자리 참 힘드네요... [3] realslow-갤로그로 이동합니다. 10.11.03 93 0
215819 다람쥐는 차캤슴다 [2] 다람쥐v갤로그로 이동합니다. 10.11.03 118 0
215818 c언어 고수님들 이건 왜이렇죠 [5] 스패넠갤로그로 이동합니다. 10.11.03 129 0
215817 다른 직종의 사람들과 이야기를 나누는것 [1] 금호족기(61.75) 10.11.03 94 0
215815 자바를 보면 드는 생각 [1] 금호족기(61.75) 10.11.03 112 0
215814 과제하나가... [2] 임베디드(121.129) 10.11.03 64 0
215813 형들..c#에서 질문좀요.. [2] c# ㅠㅠ(121.154) 10.11.03 67 0
215812 나의 이번학기 금호족기(61.75) 10.11.03 46 0
215811 아나 시발 [1] 12(168.131) 10.11.03 46 0
215810 60000힛 달성 [4] DMW(125.138) 10.11.03 128 0
215808 님들 태그에서 문자입력할때 금고래갤로그로 이동합니다. 10.11.03 35 0
215807 이런프로그램혹시 있나요;;? [1] 안녕하세요(180.70) 10.11.03 74 0
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2