從零開始學習ExtJs6系列教程一【Hello World】

黑甲可寧發表於2016-04-28


我們在學校裡學習任何一門語言都是從"Hello World"開始,這裡我們也不例外。

那麼我們的教程就從 Hello World 講起。

helloWorld.js

Ext.onReady(function() {
	Ext.MessageBox.alert('系統提示', 'Hello World!');
});

helloWorld.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" %>
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <html>
	<head>
		<%
		String path = request.getContextPath();
		String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
		%>
		<title>hello Word</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!-- 引入ExtJs樣式 -->
		<link rel="stylesheet" type="text/css" href="<%=basePath %>static/ext-6.0.0.415/build/classic/theme-neptune/resources/theme-neptune-all.css">
		<!-- 引入ExtJs核心Js -->
		<script type="text/javascript" src="<%=basePath %>static/ext-6.0.0.415/ext-bootstrap.js"></script>
		<script type="text/javascript" src="<%=basePath %>static/ext-6.0.0.415/build/ext-all.js"></script>
		<script type="text/javascript" src="<%=basePath %>static/ext-6.0.0.415/build/classic/locale/locale-zh_CN.js"></script>
		<!-- 頁面Js -->
		<script type="text/javascript" src="<%=basePath %>static/js/helloWord.js"></script>
	</head>
	<body>
	</body>
</html>


說明:
    (1)Ext.onReady():ExtJS Application的入口...就相當於Java或C#的main函式.
    (2)Ext.MessageBox.alert():彈出對話方塊。


相關文章