- 浏览: 1322 次
- 性别:
-
文章分类
最新评论
ext form表单代码:
var addDoc = new Ext.FormPanel({
baseCls: 'x-plain',
autoWidth: false,
labelWidth: 100,
labelAlign : 'right',
bodyStyle : 'padding-top:5px',
defaultType: 'textfield',
defaultWidth: '150',
items:[{
fieldLabel: '*主题名称',
id: 'theme',
anchor: '90%',
name: 'theme',
maxLength: 100,
maxLengthText: '长度不能超过100个字符',
minLength: 2,
minLengthText: '长度不能小于2个字符',
allowBlank: false,
blankText: '请输入模块名称'
},{
xtype: 'datefield',
fieldLabel: '*截止日期',
id: 'expireTime',
anchor: '90%',
name: 'expireTime',
format: 'Y-m-d',
allowBlank: false,
blankText: '请选择截止日期'
},{
fieldLabel: '创建者',
id: 'person1',
anchor: '90%',
name: 'person1',
value: '${LOGIN.person.name}',
maxLength: 20,
maxLengthText: '长度不能超过20个字符',
minLength: 2,
minLengthText: '长度不能小于2个字符',
allowBlank: false
},{
xtype: 'textarea',
anchor: '90%',
id: 'description',
name: 'description',
maxLength: 200,
maxLengthText: '长度不能超过200个字符',
fieldLabel: '主题描述',
height:30,
anchor: '90%' // anchor width by percentage and height by raw adjustment
},{
id: 'docType1',
anchor: '90%',
fieldLabel: '附件类型',
name: 'docType1',
xtype: 'combo',
bodyStyle: 'padding:10px;',
valueField: "value",
emptyText: '请选择附件类型',
blankText: '请输入附件类型',
displayField: "text",
allowBlank: false,
store:new Ext.data.SimpleStore({
fields: ["value", "text"],
data: [['1','Word主题'],['xls','Excel主题'],['jpg','JPG图片'],['jpeg','JPEG图片'],['gif','GIF图片'],['bmp','BMP图片'],['7','视频图像']]
}),
mode: 'local'
},{
fieldLabel: '*上传附件(2M)',
id: 'file-file',
name: 'file',
itmesCls: 'float-left',
clearCls: 'allow-foat',
//fileUpload : true, // 指定表单将要进行文件上传
anchor: '90%',
xtype: 'textfield',
inputType: 'file',//输入类型
listeners:{
blur:function(){
var file_upl = document.getElementById('file-file');
file_upl.select();
var filePath = document.selection.createRange().text; //获取上传文件路劲
if(filePath!=""){
var path_name=filePath.substr(filePath.lastIndexOf("\\")+1,filePath.length-1);//获取上传文件名
var fileType=filePath.substr(filePath.lastIndexOf(".")+1,filePath.length-1);//获取上传文件类型
var doc_type= Ext.getCmp("docType1").getValue(); //获取上传文件类型
if(doc_type==1){
if(fileType.toLowerCase() !="doc" && fileType.toLowerCase()!="docx"){
Ext.Msg.alert("提示信息"," 上传文件格式不正确");
return;
}
}
if(doc_type!=1 && doc_type!=7){
if(fileType.toLowerCase() !=doc_type){
Ext.Msg.alert("提示信息"," 上传文件格式不正确");
return;
}
//未验证视频格式
}
Ext.getCmp("accessory1").setText("<font color='red'>"+path_name+"</font>",false); //模板文件名称赋值
Ext.getCmp("accessory").setValue(path_name); //模板文件名称赋值
Ext.getCmp("docType").setValue(doc_type); //模板文件类型赋值
Ext.getCmp("file").setValue(filePath); //模板文件类型赋值
}
}
}
},{
xtype: 'label',
fieldLabel: '模板文件',
id: 'accessory1',
anchor: '90%',
name: 'accessory1',
allowBlank: false
}, {
xtype: 'radiogroup',
fieldLabel: '公开/私密',
anchor: '60%',
name: 'rbauto',
items: [
{boxLabel: '公开', name: 'rbauto', inputValue: 1},
{boxLabel: '私密', name: 'rbauto', inputValue: 0, checked: true}
]
},{
//隐藏文本框赋值,上传文件类型
id: 'docType',
hidden: true,
name: 'docType'
},{
//隐藏文本框赋值,上传文件名
id: 'accessory',
hidden: true,
name: 'accessory'
},{
//隐藏文本框赋值,用户ID
id: 'person',
hidden: true,
name: 'person',
value: '${LOGIN.id}'
}],
buttons: [{
text: '保存',
handler:function(){
if(addDoc.form.isValid()){
Ext.MessageBox.show({
title: '提示',
msg: '正在保存...',
progressText: '',
width: 300,
progress: true,
closable: false,
animEl: 'loding'
});
var f = function(v){
return function(){
var i = v/11;
Ext.MessageBox.updateProgress(i, '');
};
};
for(var i = 1; i < 13; i++){
setTimeout(f(i), i*150);
}
addDoc.form.doAction('submit',{
url:'docSendManager.do?method=saveAndUpdateDoc',
method:'post',
success:function(form,action){
if (action.result.msg=='ok') {
addDoc.form.reset();
addDocWindow.hide();
Ext.MessageBox.hide();
Ext.Msg.alert('操作提示',"保存成功");
reloadTreeAndGrid();
} else {
Ext.Msg.alert('操作提示',action.result.msg);
}
},
failure:function(){
Ext.Msg.alert('操作提示','服务器错误,请稍后再试...');
}
});
}
}
},{
text: '重置',
handler:function(){addDoc.form.reset();}
}
]
});
actionfrom部分代码:
/**
* 稿件模板附件引用相对路径
*
* @hibernate.property
*/
private FormFile file;
private String expireTime;//截止时间
private String description;// 主题描述
private String rbauto;//公开/私密状态
private String person; //用户
public FormFile getFile() {
return file;
}
public void setFile(FormFile file) {
this.file = file;
}
public String getPerson() {
return person;
}
public void setPerson(String person) {
action部分代码
public ActionForward saveAndUpdateDoc(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
response.setContentType("text/html");
// 设置字符编码为UTF-8, 这样支持汉字显示
response.setCharacterEncoding("UTF-8");
FileManagerForm fileManager = (FileManagerForm) form;
FormFile pfile = fileManager.getFile();//获取文件路径
String docName=fileManager.getTheme();//主题名
String endTime=fileManager.getExpireTime();// 截止日期
String dec=fileManager.getDescription();//描述
String doctype=fileManager.getDocType();//附件类型
String accessory=fileManager.getAccessory();//附件名称
int rbauto=Integer.parseInt(fileManager.getRbauto());//公开/私密
int person=Integer.parseInt(fileManager.getPerson());// 用户ID
System.out.println("文件路径:"+pfile);
System.out.println("主题名:"+docName);
System.out.println("截止日期:"+endTime);
System.out.println("描述:"+dec);
System.out.println("附件类型:"+doctype);
System.out.println("附件名称:"+accessory);
System.out.println("公开/私密"+rbauto);
System.out.println("用户ID"+person);
Object logger;
FormFile file = fileManager.getFile();
String tmpFolder = "";
String extName = "";
String fullPath = "";
if (null != file && !"".equals(file.getFileName())) {
String contentType = file.getContentType();
String size = (file.getFileSize() + "bytes");
String fileName = file.getFileName();
extName = fileName.split("\\.")[1];
tmpFolder = String.valueOf(System.currentTimeMillis());
fullPath = "/photo/templates/" + tmpFolder + "/" + fileName;
try {
String filePath = "";// 取当前系统路径
if (new File("d:\\photo").isDirectory()) {
filePath = "d:\\";
} else {
filePath = request.getRealPath("/");
}
File mDir = new File(filePath + "/photo/templates/"
+ tmpFolder);
if (!mDir.isDirectory()) {
mDir.mkdirs();
}
InputStream stream = file.getInputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream bos = new FileOutputStream(filePath + fullPath);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
bos.write(buffer, 0, bytesRead);// 将文件写入服务器
}
bos.close();
stream.close();
} catch (Exception e) {
log.error("上传出现异常");
}
打印结果::
文件路径:null
主题名:111111
截止日期:2012-03-17
描述:1111111
附件类型:1
附件名称:四川电大毕业设计.doc
公开/私密0
用户ID2026
请问。。为什么file为null呀??
我换成File接收也是null、。、
网上查说将:fileUpload : true
但是这样也不行。。。
在aip中,也没有找到fileUpload 属性
还有的说将:xtype:'uploadPanel'
同样,,在3.2的api中也xtype没有发现有这个属性。
请问应该怎么样,才能
var addDoc = new Ext.FormPanel({
baseCls: 'x-plain',
autoWidth: false,
labelWidth: 100,
labelAlign : 'right',
bodyStyle : 'padding-top:5px',
defaultType: 'textfield',
defaultWidth: '150',
items:[{
fieldLabel: '*主题名称',
id: 'theme',
anchor: '90%',
name: 'theme',
maxLength: 100,
maxLengthText: '长度不能超过100个字符',
minLength: 2,
minLengthText: '长度不能小于2个字符',
allowBlank: false,
blankText: '请输入模块名称'
},{
xtype: 'datefield',
fieldLabel: '*截止日期',
id: 'expireTime',
anchor: '90%',
name: 'expireTime',
format: 'Y-m-d',
allowBlank: false,
blankText: '请选择截止日期'
},{
fieldLabel: '创建者',
id: 'person1',
anchor: '90%',
name: 'person1',
value: '${LOGIN.person.name}',
maxLength: 20,
maxLengthText: '长度不能超过20个字符',
minLength: 2,
minLengthText: '长度不能小于2个字符',
allowBlank: false
},{
xtype: 'textarea',
anchor: '90%',
id: 'description',
name: 'description',
maxLength: 200,
maxLengthText: '长度不能超过200个字符',
fieldLabel: '主题描述',
height:30,
anchor: '90%' // anchor width by percentage and height by raw adjustment
},{
id: 'docType1',
anchor: '90%',
fieldLabel: '附件类型',
name: 'docType1',
xtype: 'combo',
bodyStyle: 'padding:10px;',
valueField: "value",
emptyText: '请选择附件类型',
blankText: '请输入附件类型',
displayField: "text",
allowBlank: false,
store:new Ext.data.SimpleStore({
fields: ["value", "text"],
data: [['1','Word主题'],['xls','Excel主题'],['jpg','JPG图片'],['jpeg','JPEG图片'],['gif','GIF图片'],['bmp','BMP图片'],['7','视频图像']]
}),
mode: 'local'
},{
fieldLabel: '*上传附件(2M)',
id: 'file-file',
name: 'file',
itmesCls: 'float-left',
clearCls: 'allow-foat',
//fileUpload : true, // 指定表单将要进行文件上传
anchor: '90%',
xtype: 'textfield',
inputType: 'file',//输入类型
listeners:{
blur:function(){
var file_upl = document.getElementById('file-file');
file_upl.select();
var filePath = document.selection.createRange().text; //获取上传文件路劲
if(filePath!=""){
var path_name=filePath.substr(filePath.lastIndexOf("\\")+1,filePath.length-1);//获取上传文件名
var fileType=filePath.substr(filePath.lastIndexOf(".")+1,filePath.length-1);//获取上传文件类型
var doc_type= Ext.getCmp("docType1").getValue(); //获取上传文件类型
if(doc_type==1){
if(fileType.toLowerCase() !="doc" && fileType.toLowerCase()!="docx"){
Ext.Msg.alert("提示信息"," 上传文件格式不正确");
return;
}
}
if(doc_type!=1 && doc_type!=7){
if(fileType.toLowerCase() !=doc_type){
Ext.Msg.alert("提示信息"," 上传文件格式不正确");
return;
}
//未验证视频格式
}
Ext.getCmp("accessory1").setText("<font color='red'>"+path_name+"</font>",false); //模板文件名称赋值
Ext.getCmp("accessory").setValue(path_name); //模板文件名称赋值
Ext.getCmp("docType").setValue(doc_type); //模板文件类型赋值
Ext.getCmp("file").setValue(filePath); //模板文件类型赋值
}
}
}
},{
xtype: 'label',
fieldLabel: '模板文件',
id: 'accessory1',
anchor: '90%',
name: 'accessory1',
allowBlank: false
}, {
xtype: 'radiogroup',
fieldLabel: '公开/私密',
anchor: '60%',
name: 'rbauto',
items: [
{boxLabel: '公开', name: 'rbauto', inputValue: 1},
{boxLabel: '私密', name: 'rbauto', inputValue: 0, checked: true}
]
},{
//隐藏文本框赋值,上传文件类型
id: 'docType',
hidden: true,
name: 'docType'
},{
//隐藏文本框赋值,上传文件名
id: 'accessory',
hidden: true,
name: 'accessory'
},{
//隐藏文本框赋值,用户ID
id: 'person',
hidden: true,
name: 'person',
value: '${LOGIN.id}'
}],
buttons: [{
text: '保存',
handler:function(){
if(addDoc.form.isValid()){
Ext.MessageBox.show({
title: '提示',
msg: '正在保存...',
progressText: '',
width: 300,
progress: true,
closable: false,
animEl: 'loding'
});
var f = function(v){
return function(){
var i = v/11;
Ext.MessageBox.updateProgress(i, '');
};
};
for(var i = 1; i < 13; i++){
setTimeout(f(i), i*150);
}
addDoc.form.doAction('submit',{
url:'docSendManager.do?method=saveAndUpdateDoc',
method:'post',
success:function(form,action){
if (action.result.msg=='ok') {
addDoc.form.reset();
addDocWindow.hide();
Ext.MessageBox.hide();
Ext.Msg.alert('操作提示',"保存成功");
reloadTreeAndGrid();
} else {
Ext.Msg.alert('操作提示',action.result.msg);
}
},
failure:function(){
Ext.Msg.alert('操作提示','服务器错误,请稍后再试...');
}
});
}
}
},{
text: '重置',
handler:function(){addDoc.form.reset();}
}
]
});
actionfrom部分代码:
/**
* 稿件模板附件引用相对路径
*
* @hibernate.property
*/
private FormFile file;
private String expireTime;//截止时间
private String description;// 主题描述
private String rbauto;//公开/私密状态
private String person; //用户
public FormFile getFile() {
return file;
}
public void setFile(FormFile file) {
this.file = file;
}
public String getPerson() {
return person;
}
public void setPerson(String person) {
action部分代码
public ActionForward saveAndUpdateDoc(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
response.setContentType("text/html");
// 设置字符编码为UTF-8, 这样支持汉字显示
response.setCharacterEncoding("UTF-8");
FileManagerForm fileManager = (FileManagerForm) form;
FormFile pfile = fileManager.getFile();//获取文件路径
String docName=fileManager.getTheme();//主题名
String endTime=fileManager.getExpireTime();// 截止日期
String dec=fileManager.getDescription();//描述
String doctype=fileManager.getDocType();//附件类型
String accessory=fileManager.getAccessory();//附件名称
int rbauto=Integer.parseInt(fileManager.getRbauto());//公开/私密
int person=Integer.parseInt(fileManager.getPerson());// 用户ID
System.out.println("文件路径:"+pfile);
System.out.println("主题名:"+docName);
System.out.println("截止日期:"+endTime);
System.out.println("描述:"+dec);
System.out.println("附件类型:"+doctype);
System.out.println("附件名称:"+accessory);
System.out.println("公开/私密"+rbauto);
System.out.println("用户ID"+person);
Object logger;
FormFile file = fileManager.getFile();
String tmpFolder = "";
String extName = "";
String fullPath = "";
if (null != file && !"".equals(file.getFileName())) {
String contentType = file.getContentType();
String size = (file.getFileSize() + "bytes");
String fileName = file.getFileName();
extName = fileName.split("\\.")[1];
tmpFolder = String.valueOf(System.currentTimeMillis());
fullPath = "/photo/templates/" + tmpFolder + "/" + fileName;
try {
String filePath = "";// 取当前系统路径
if (new File("d:\\photo").isDirectory()) {
filePath = "d:\\";
} else {
filePath = request.getRealPath("/");
}
File mDir = new File(filePath + "/photo/templates/"
+ tmpFolder);
if (!mDir.isDirectory()) {
mDir.mkdirs();
}
InputStream stream = file.getInputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream bos = new FileOutputStream(filePath + fullPath);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
bos.write(buffer, 0, bytesRead);// 将文件写入服务器
}
bos.close();
stream.close();
} catch (Exception e) {
log.error("上传出现异常");
}
打印结果::
文件路径:null
主题名:111111
截止日期:2012-03-17
描述:1111111
附件类型:1
附件名称:四川电大毕业设计.doc
公开/私密0
用户ID2026
请问。。为什么file为null呀??
我换成File接收也是null、。、
网上查说将:fileUpload : true
但是这样也不行。。。
在aip中,也没有找到fileUpload 属性
还有的说将:xtype:'uploadPanel'
同样,,在3.2的api中也xtype没有发现有这个属性。
请问应该怎么样,才能
相关推荐
系统采用Ajax(前端)+Struts(后台)+存储过程(数据库)的设计,其中EXTjs用于前端界面组件,Servlet处理异步请求,Struts管理页面逻辑。存储过程用于优化数据库操作。 3.2 前端页面结构 前端页面分为用户管理、...
1.2国内外研究现状 1.3主要研究内容 2 开发工具与环境 2.1 jsp-extjs 2.2 javabean及Hibernate 2.3 Struts2、MVC和Spring 2.4数据库MySQL 2.5开发工具MyEclipse8.6 3 系统需求分析 3.1系统总体目标 3.2...
资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。
wrf转mp4播放器1.1.1
内容概要:本文档详细介绍了如何在Simulink中设计一个满足特定规格的音频带ADC(模数转换器)。首先选择了三阶单环多位量化Σ-Δ调制器作为设计方案,因为这种结构能在音频带宽内提供高噪声整形效果,并且多位量化可以降低量化噪声。接着,文档展示了具体的Simulink建模步骤,包括创建模型、添加各个组件如积分器、量化器、DAC反馈以及连接它们。此外,还进行了参数设计与计算,特别是过采样率和信噪比的估算,并引入了动态元件匹配技术来减少DAC的非线性误差。性能验证部分则通过理想和非理想的仿真实验评估了系统的稳定性和各项指标,最终证明所设计的ADC能够达到预期的技术标准。 适用人群:电子工程专业学生、从事数据转换器研究或开发的技术人员。 使用场景及目标:适用于希望深入了解Σ-Δ调制器的工作原理及其在音频带ADC应用中的具体实现方法的人群。目标是掌握如何利用MATLAB/Simulink工具进行复杂电路的设计与仿真。 其他说明:文中提供了详细的Matlab代码片段用于指导读者完成整个设计流程,同时附带了一些辅助函数帮助分析仿真结果。
国网台区终端最新规范
《基于YOLOv8的智慧农业水肥一体化控制系统》(包含源码、可视化界面、完整数据集、部署教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计
GSDML-V2.33-LEUZE-AMS3048i-20170622.xml
微信小程序项目课程设计,包含LW+ppt
微信小程序项目课程设计,包含LW+ppt
终端运行进度条脚本
幼儿园预防肺结核教育培训课件资料
python,python相关资源
《基于YOLOv8的智慧校园电动车充电桩状态监测系统》(包含源码、可视化界面、完整数据集、部署教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计
deepseek 临床之理性软肋.pdf
SM2258XT量产工具(包含16种程序),固态硬盘量产工具使用
RecyclerView.zip
水务大脑让水务运营更智能(23页)
资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。