Java 从bootstrap x-editable发送数据
如何将数据从bootstrap x-editable发送到servlet?目前我的设置如下:Java 从bootstrap x-editable发送数据,java,jquery,twitter-bootstrap,servlets,x-editable,Java,Jquery,Twitter Bootstrap,Servlets,X Editable,如何将数据从bootstrap x-editable发送到servlet?目前我的设置如下: $(document).ready( function() { $('a.accordion-toggle').editable({ ajaxOptions: { dataType: 'json' }, placement: 'right', name: 'toEdit', url: '..
$(document).ready( function() {
$('a.accordion-toggle').editable({
ajaxOptions: {
dataType: 'json'
},
placement: 'right',
name: 'toEdit',
url: '../admin/module_edit.do',
title: 'Edit'
});
});
@RequestMapping( value = "/admin/module_edit", method = RequestMethod.POST )
public @ResponseBody
String editSubjectAndStrand( @RequestParam
String toEdit, HttpServletRequest request )
{
System.out.println( toEdit );
return "";
}
我的servlet是这样的:
$(document).ready( function() {
$('a.accordion-toggle').editable({
ajaxOptions: {
dataType: 'json'
},
placement: 'right',
name: 'toEdit',
url: '../admin/module_edit.do',
title: 'Edit'
});
});
@RequestMapping( value = "/admin/module_edit", method = RequestMethod.POST )
public @ResponseBody
String editSubjectAndStrand( @RequestParam
String toEdit, HttpServletRequest request )
{
System.out.println( toEdit );
return "";
}
它现在没有在我的服务器端打印任何内容。我做错了什么?最后我发现了错误。我还应该为它定义
pk
,以便向服务器发送ajax请求。这个问题可以帮助我解决。文件中有以下部分:
应该定义的主要属性是:类型-输入类型(文本、文本区域、选择等)
url-服务器端脚本的url,用于处理提交的值(/post、post.php等)
pk-要更新的记录的主键(以db为单位的ID)
id或名称-要更新的字段名称(以db为单位的列)。取自身份证 或数据名称属性
值初始值。用于选择,其中值是要选择的文本的整数键 展示。如果为空-将从元素html内容中获取
您没有从控制器返回
JSON
,而是返回String
@Jai Yes。我只是在测试可编辑程序是否正在向我的控制器发送数据。System.out.println(toEdit)代码>不在控制台中打印任何内容。看起来它甚至都没给我的控制器打电话。