我们在学校里学习任何一门语言都是从"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():弹出对话框。