日期:2014-05-16  浏览次数:20686 次

ext3的版本里加个上传的框 - Web 开发 / Ajax
代码长了一些,抱歉,其他的地方不用看的,就看我在程序中标注的那部分就好了的


<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="cn.tc.ysale.model.sms.*,cn.tc.ysale.model.user.*,cn.tc.ysale.commons.*" %>
<%
  User user = SessionHelper.getLoginAttribute(session).getUser();
  String chooseTitle = user.getType()==1?"选择供应商":"选择超市用户";
  Sms sms = (Sms)request.getAttribute("sms");
  String sendid = "";
  String title = "";
  String content = "";
  if(sms!=null)
  {
  sendid = sms.getUsername();
  title = "回复:"+sms.getTitle();
  content = sms.getContent();
  }
%>
<html>
<head><title>${sessionScope.applicationName}</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/ext/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/common.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/ext/ext-all.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/ext/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/common.js"></script>
<script type="text/javascript">
function onSave(flag,msg)
{
  if(flag)
  {
  goBack();
  }
  else
  {
  if(msg)
  {
  alert(msg);
  }
  else
  {
  alert('保存出错');
  }
  }
}
function goBack()
{
  var url = './sms.jspx';
  window.location.replace(url);
}
function chooseRel()
{
  var url = './sms.jspx?method=chooseuser';
  parent.__showDialog('<%=chooseTitle%>',url,800,600);
}
function clearRel()
{
  document.all.xrelid.value = "";
}
Ext.onReady(function(){
  var bodyWidth = document.body.clientWidth;
  var bodyHeight = document.body.clientHeight;
  var relid = new Ext.form.DisplayField({
  fieldLabel: '收件人',
  name: 'relid',
  value:'<input id=xrelid name=xrelid type=text value="<%=sendid%>" style=width:90%>&nbsp;<span class=clink onclick=chooseRel()>选择</span>&nbsp;<span class=clink onclick=clearRel()>清除</span>'
  });
  var title = new Ext.form.TextField({
  fieldLabel: '标&nbsp;&nbsp;&nbsp;题',
  name: 'title',
  allowBlank:false,
  value:'<%=title%>',
  anchor:'100%'
  });
  ////////// 问题一:这个部分是我自己加上去的,是不是这个就是建立了一个上传文件的了?

  ///////////可是我怎么接收不到呢
  var pic = new Ext.form.TextField({
  fieldLabel: '附&nbsp;&nbsp;&nbsp;件',
  name: 'pic',
  inputType: 'file',
  anchor:'100%'
  });
  //---------------------------------------------------
  var content = new Ext.form.HtmlEditor({
  hideLabel: true,
  anchor: '100%',
  height: bodyHeight-130,
  name: 'content', // 内容的form名,