java 后台获取前端数据问题
我在前台用ext写
var formPanel = new Ext.FormPanel({ id:"zone", frame : true, labelAlign : 'right', buttonAlign :'right', border : false, items : [ { id:'ID', value:dataList.id, xtype:'hidden' }, { xtype : 'textfield', id : 'name', value:dataList.name, dataIndex:'name', name : 'name', allowBlank : false, blankText : '必须填写用户名', width : 400, fieldLabel : '标题' },{ id:"content", name:"content", value:dataList.content, xtype:'htmleditor', /*width:500, autoHeight:true,*/ fieldLabel:"内容", fontFamilies : ['宋体', '隶书', '黑体', '楷体'], buttonTips : { bold : {title:'Bold (Ctrl+B)',text:'粗体'}, italic : {title:'Italic (Ctrl+I)',text:'斜体'}, underline : {title:'Underline (Ctrl+U)',text:'下划线'}, increasefontsize : {title:'Grow Text',text:'增大字体'}, decreasefontsize : {title:'Shrink Text',text:'缩小字体'}, backcolor : {title:'Text Highlight',text:'背景色'}, forecolor : {title:'Font Color',text:'前景色'}, justifyleft : {title:'Align Text Left',text:'左对齐'}, justifycenter : {title:'Center Text',text:'居中对齐'}, justifyright : {title:'Align Text Right',text:'右对齐'}, insertunorderedlist : {title:'Bullet List',text:'项目符号'}, insertorderedlist : {title:'Numbered List',text:'数字编号'}, createlink : {title:'Hyperlink',text:'超链接'}, sourceedit : {title:'Source Ecit',text:'切换源代码编辑模式'} } }] });
然后用
var id=formPanel.findById("ID").getValue(); var name=formPanel.findById("name").getValue(); var content=formPanel.findById("content").getValue(); console.info("cont:"+content);
这里打印的是
接着用ajax传到后台
Ext.Ajax.request({ url:url, mothed:'post', params:{ id:id, name:name, content:cont }, success :function(response, action) { win.close(); }, failure :function(response) { Ext.Msg.show({ title:'提示', buttons:Ext.MessageBox.OK, icon:Ext.MessageBox.ERROR, msg:'保存失败,请联系管理员!' }); } });
后台获取:
String content = getRequest().getParameter("content"); System.out.println("=============content====="+content);
后台打印的是:
为什么后台接收的数据是?ggsadfa。前面有个问号的,而其他数据没有,这和前台的控件htmleditor有关吗,那要如何处理,是后台的接收的数据正常。
谢谢!!
如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

评论(6)

发布评论
需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。