谁给写一个 使用jsp、extjs 的实例啊简单就好 最好有一两行关键解释
菜鸟 求助
菜鸟 求助
解决方案 »
- struts整合spring、hibernate出现的问题 java.lang.reflect.InvocationTargetException
- 怎样利用水晶报表自动将指定报表以Excel方式发邮件给指定用户(求关注)
- javamail发邮件的问题?
- 很困难的一个问题 关于屏蔽ie下载功能 或是在线浏览office
- 准备给100分!请各位帮忙解决一个棘手问题!
- javax.servlet.jsp.JspException: No getter method for property eDate of bean org.apache.struts.taglib.html.BEAN
- 一个build.xml问题~
- 初学EJB,提个基本问题???
- 熟悉 Lotus Domino Toolkit for Java/CORBA 进来领分!
- java一道数组互换题
- 下载整个网站的软件
- action层可以不用任何配置就用Spring注入吗
去这个下载看看吧。
看了虽然看懂了但是貌似写到我的工程里还是无法显示ext的效果额。。
我在jsp里ctrl追踪的js和css文件都弄好了路径没问题。代码原封不动。不知道哪里可能没配吧。新手求指教。
我只写了index.js、复制ext文件夹到我的工程下并在index.jsp下引用 别的没做修改。还要做哪些??
ApplicationGridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
projectid : 'default',
editWin : null, // 声明 变更项目申请信息窗体
addWin : null,// 声明 增加项目申请信息窗口
detailWin : null, //声明 详细项目申请信息窗口
pageSize : 10,// 每页记录数
/**
* 构造方法
*/
constructor : function(_config) {
if (_config == null) {
_config = {};
}
Ext.apply(this, _config);
// // 实例化变更住户信息窗体.
this.editWin = new EditApplicationWindow();
this.addWin = new AddApplicationWindow();
this.detailWin = new ApplicationDetailWindow();
//
//初始化数据存储store,加载项目申请信息
this['store'] = new Ext.data.JsonStore({
url : 'applicationAction!findApplicationByPage.action',
root : 'rows',
totalProperty : 'totalCount',
fields : ['projectId','projectCode', 'projectName', 'operatorId', 'operatorTime']
});
这是我的jsp和ext文件夹的位置
index.jsp<%@ page language="java" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>学生信息管理</title>
<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">
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css">
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all.js"></script>
<script type="text/javascript" src="ext/build/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="ext/index.js"></script>
</head>
<body>
<div id="head" style="font-weight: bold;font-size: 200%;">学生信息管理</div>
<div id="foot" style="text-align: right;"> - ©2009 <a href="http://www.xmqhit.com" target="_blank">xmqhit</a></div>
</body>
</html>================================================Ext.onReady(function(){
var sexRenderer = function(val){
if(val == 1){
return "<span style='color:red;font-weight:bold;'>男</span>";
}else{
return "<span style='color:green;font-weight:bold'>女</span>";
}
}
var sturec = new Ext.data.Record.create([
{name:'id',type:'int'},
{name:'code',type:'string'},
{name:'name',type:'string'},
{name:'sex',type:'int'},
{name:'age',type:'int'},
{name:'political',type:'string'},
{name:'origin',type:'string'},
{name:'professional',type:'string'}
]);
var store = new Ext.data.Store({
proxy:new Ext.data.HttpProxy({url:'stuquery'}),
reader:new Ext.data.JsonReader({
totalProperty:'totalProperty',
root:'root'
},sturec),
remoteSort:true
});
store.load({params:{start:0,limit:15}});
var cols = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
{header:'学号',dataIndex:'code'},
{header:'姓名',dataIndex:'name'},
{header:'性别',dataIndex:'sex',renderer:sexRenderer},
{header:'年龄',dataIndex:'age'},
{header:'政治面貌',dataIndex:'political'},
{header:'籍贯',dataIndex:'origin'},
{header:'所属系',dataIndex:'professional'}
]);
cols.defaultSortable = true;
var grid = new Ext.grid.GridPanel({
title:'学生信息列表',
region:'center',
loadMask:true,
store:store,
cm:cols,
sm:new Ext.grid.RowSelectionModel({singleSelect:true}),
viewConfig:{
forceFit:true
},
bbar:new Ext.PagingToolbar({
pageSize:15,
store:store,
displayInfo:true
})
});
var form = new Ext.form.FormPanel({
title:'编辑学生信息',
region:'east',
frame:true,
width:300,
autoHeight:true,
labelAlign:'right',
labelWidth:60,
defaultType:'textfield',
defaults:{
width:200,
allowBlank:false
},
items:[
{xtype:'hidden',name:'id'},
{fieldLabel:'学号',name:'code'},
{fieldLabel:'姓名',name:'name'},
{fieldLabel:'年龄',name:'age',xtype:'numberfield',allowNegative:false},
{fieldLabel:'性别',name:'sexText',hiddenName:'sex',xtype:'combo',
store:new Ext.data.SimpleStore({
fields:['value','text'],
data:[['1','男'],['0','女']]
}),
emptyText:'请选择',
mode:'local',
triggerAction:'all',
valueField:'value',
displayField:'text',
readOnly:true
},
{fieldLabel:'政治面貌',
name:'political',
xtype:'combo',
store:new Ext.data.SimpleStore({
fields:['text'],
data:[['群众'],['党员'],['团员']]
}),
emptyText:'请选择',
mode:'local',
triggerAction:'all',
valueField:'text',
displayField:'text',
readOnly:true
},
{fieldLabel:'籍贯',name:'origin'},
{fieldLabel:'所属系',name:'professional'}
],
buttons:[
{
text:'添加',
handler:function(){
if(!form.getForm().isValid()){
return;
}
form.getForm().submit({
url:'stuaddmod',
success:function(f,action){
Ext.Msg.alert('消息',action.result.msg,function(){
grid.getStore().reload();
form.getForm().reset();
form.buttons[0].setText('添加')
});
},
failure:function(){
Ext.Msg.alert('错误','操作失败!');
}
})
}
},
{
text:'清空',
handler:function(){
form.getForm().reset();
form.buttons[0].setText('添加');
}
},
{
text:'删除',
handler:function(){
var id = form.getForm().findField("id").getValue();
if(id == ""){
Ext.Msg.alert('提示','请选择要删除的信息。');
}else{
Ext.Ajax.request({
url:'studel',
success:function(response){
var json = Ext.decode(response.responseText);
Ext.Msg.alert('消息',json.msg,function(){
grid.getStore().reload();
form.getForm().reset();
form.buttons[0].setText('添加');
});
},
failure:function(){
Ext.Msg.alert('错误','删除失败!');
},
params:"id="+id
})
}
}
}
]
});
grid.on('rowClick',function(grid,rowIndex,event){
var rec = grid.getStore().getAt(rowIndex);
form.getForm().loadRecord(rec);
form.buttons[0].setText('修改');
});
var viewport = new Ext.Viewport({
layout:'border',
items:[
{region:'north',contentEl:'head'},
grid,
form,
{region:'south',contentEl:'foot'}
]
});
});
其余地方均未作对ext的配置 不知道哪儿出问题了。。打开页面后jsp只显示body里面的。。关于那个index.js这个文件的都没有效果