从bootstrap对话框提交submittibg时,不传递Struts1处理程序参数 [英] Struts1 handler parameter not passing when submittibg from bootstrap dialog

查看:103
本文介绍了从bootstrap对话框提交submittibg时,不传递Struts1处理程序参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有struts1调度操作和一个有两个提交按钮的表单,这些按钮有参数和值,用值调用方法名称。好吧没有问题。



但是当点击删除按钮时,我想用bootstrap对话框确认。

I have working struts1 dispatch action and a form having two submit buttons which have parameter and value which calls method name with value. Well there is no problem.

But when clicking on delete button, I want to confirm with bootstrap dialog.

$('.btnDelete').on('click', function(e){
        var $form=$(this).closest('form');
        e.preventDefault();
        $('#confirm').modal({ backdrop: 'static', keyboard: false })
        .one('click', '#delete', function (e) {
            var sectorId = $(this).parent().parent().children()[0].innerHTML;
            var input = document.createElement("input");
            input.setAttribute("type", "hidden");
            input.setAttribute("name", "sectorId");
            input.setAttribute("value", sectorId);
            document.getElementById("sectorForm").appendChild(input);
            $("#sectorForm").submit();
        });
    });



此处 e.preventDefault()需要停止表单提交。当从对话框中单击删除按钮时,将传递隐藏参数并提交表单。但是服务器显示以下错误消息。



HTTP状态500 - 请求[/ SectorManagement]不包含名为'action'的处理程序参数。这可能是由标签文本中的空格引起的。



请注意,删除引导程序对话框时没有问题。



我将不胜感激任何帮助,

谢谢。



< b>我尝试了什么:



如您所见,我正在尝试使用引导程序对话框确认删除操作。

问题是为什么默认提交和jquery提交是不同的。

即使用jquery提交不会将参数传递给调度操作。


Here e.preventDefault() is needed to stop form submitting. And when a delete button is clicked from dialog a hidden parameter will be passed and form will submit. But sever shows below error message.

HTTP Status 500 - Request[/SectorManagement] does not contain handler parameter named 'action'. This may be caused by whitespace in the label text.

Please note that there is no problem when removing bootstrap dialog.

I would appreciate any help,
Thank you.

What I have tried:

As you can see, I am trying to confirm delete action using bootstrap dialog.
The problem is that why default submission and jquery submission is different.
i.e. Submitting using jquery does not passing parameters to dispatch action.

推荐答案

' 。btnDelete')。on(' 点击'功能(e){
var
('.btnDelete').on('click', function(e){ var


form =


this )。最近的(' form');
e.preventDefault();
(this).closest('form'); e.preventDefault();


这篇关于从bootstrap对话框提交submittibg时,不传递Struts1处理程序参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆