java - 从 bootstrap 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: '../admin/module_edit.do',
        title: 'Edit'
    });
});

我的servlet是这样的:

@RequestMapping( value = "/admin/module_edit", method = RequestMethod.POST )
public @ResponseBody
String editSubjectAndStrand( @RequestParam
String toEdit, HttpServletRequest request )
{
    System.out.println( toEdit );
    return "";
}

它现在没有在我的服务器端打印任何内容。我做错了什么?

最佳答案

终于发现错误了。我还应该定义 pk 来将 ajax 请求发送到服务器。 documentation帮我解决这个问题。文档中有这部分:

Main attributes you should define are:
type - type of input (text, textarea, select, etc)
url - url to server-side script to process submitted value (/post, post.php etc)
pk - primary key of record to be updated (ID in db)
id or name - name of field to be updated (column in db). Taken from id or data-name attribute
value - initial value. Usefull for select, where value is integer key of text to be shown. If empty - will be taken from element html contents

关于java - 从 bootstrap x-editable 发送数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19925984/

相关文章:

javascript - UI-路由器。如何导航到项目中我不想包含为状态的页面?

jquery - 仅显示特定的响应图像

html - 无法更改 Bootstrap-select selectpicker 的标题

javascript - 使用 CodeMirror 的 Bootstrap 选项卡

java - 从 DataFrame 转换为 JavaPairRDD<Long, Vector>

java - icu4j-2.6.1.jar : java. lang.IllegalStateException : Unknown tag! pos=40 poolCount = 47

java - List<Dog> 是 List<Animal> 的子类吗?为什么 Java 泛型不是隐式多态的?

javascript - 如何使用 jQuery 和 Bootstrap 在文档中创建多个模式?

Java - 如何让类 1 和类 2 互相了解?

Javascript 数组显示不是数组错误