1、在项目的基础上添加:点击打开链接
2、welcome.jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Basic Panel - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="./easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="./easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="./easyui/demo/demo.css">
<script type="text/javascript" src="./easyui/jquery.min.js"></script>
<script type="text/javascript" src="./easyui/jquery.easyui.min.js"></script>
<title>Insert title here</title>
</head>
<body>
<h2>Basic Layout</h2>
<p>The layout contains north,south,west,east and center regions.</p>
<div style="margin:20px 0;"></div>
<div class="easyui-layout" style="width:700px;height:350px;">
<div data-options="region:'north'" style="height:50px">
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="$('#p').panel('open')">Add</a>
</div>
<div data-options="region:'south',split:true" style="height:50px;"></div>
<div data-options="region:'east',split:true" title="East" style="width:100px;"></div>
<div data-options="region:'west',split:true" title="West" style="width:100px;"></div>
<div data-options="region:'center',title:'Main Title',iconCls:'icon-ok'">
<table class="easyui-datagrid"
data-options="url:'queryEmployee.html',method:'get',border:false,singleSelect:true,fit:true,fitColumns:true">
<thead>
<tr>
<th data-options="field:'id'" width="80">Id</th>
<th data-options="field:'age'" width="100">Age</th>
<th data-options="field:'name'" width="100">Name</th>
<th data-options="field:'salary'" width="80">Salary</th>
<th data-options="field:'department'" width="200">Department</th>
<th data-options="field:'position'" width="150">Position</th>
<th data-options="field:'phone'" width="200">Phone</th>
<th data-options="field:'e_mail'" width="200">E-Mail</th>
</tr>
</thead>
</table>
</div>
</div>
<div id="p" class="easyui-window" title="Add New Employee" data-options="iconCls:'icon-save'" closed="true" style="width:500px;height:500px;padding:5px;">
<div style="padding:10px 60px 20px 60px">
<form id="ff" method="post">
<table cellpadding="7">
<tr>
<td>Age:</td>
<td><input class="easyui-textbox" type="text" name="age" data-options="required:true"></input></td>
</tr>
<tr>
<td>Name:</td>
<td><input class="easyui-textbox" type="text" name="name" data-options="required:true"></input></td>
</tr>
<tr>
<td>Salary:</td>
<td><input class="easyui-textbox" type="text" name="salary" data-options="required:true"></input></td>
</tr>
<tr>
<td>Department:</td>
<td><input class="easyui-textbox" type="text" name="department" data-options="required:true"></input></td>
</tr>
<tr>
<td>Position:</td>
<td><input class="easyui-textbox" type="text" name="position" data-options="required:true"></input></td>
</tr>
<tr>
<td>Phone:</td>
<td><input class="easyui-textbox" type="text" name="phone" data-options="required:true"></input></td>
</tr>
<tr>
<td>E-Mail:</td>
<td><input class="easyui-textbox" type="text" name="e_mail" data-options="required:true"></input></td>
</tr>
</table>
</form>
<div style="text-align:center;padding:5px">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">Submit</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">Clear</a>
</div>
</div>
</div>
<script>
function submitForm(){
$('#ff').form('submit',{
url : 'createEmployee.html',
onSubmit : function() {
return $(this).form('validate');//对数据进行格式化
},
success : function(data) {
$.messager.show({
title : 'Added success!',
msg : data
});
}
});
}
function clearForm(){
$('#ff').form('clear');
}
</script>
</body>
</html>