0
<script type="text/javascript">
$(document).ready(function(){
    $(".add").click(function() {
            $("#dialog-form").dialog("open");
    });
    $(".update").click(function() {
                //ID value will be replaced... 
        $.get("updateCategoryPage?category_id=ID", function (data) {
            $("#dialog-form").dialog("open");
        });


    });
</script>

我有两个按钮,分别用于添加和更新类添加和更新。因此,单击一下,我正在 $.get 方法中进行控制器调用,如上所示,它正在调用并执行控制器代码并返回同一页面。

/* 这里我有一个包含一些字段的表单,其中的值是对象值,例如学生姓名和学生 ID……在控制器中,我正在使用学生对象设置请求范围并进入此页面,但没有显示值!在更新弹出对话框中 */

我想重用相同的代码来添加和更新以前我有两个用于添加和更新的jsp,我现在的请求是使用相同的jsp页面我遇到了这个问题尽快帮助我..

4

1 回答 1

1

As Arun mentioned the problem in your code is you need to concat the ID variable like "updateCategoryPage?category_id="+ID For you this site can be helpful.It has got nice UI in case you want to change your UI too if you like.Also just a tip.If you want to post more than one variable you can do it like:"updateCategoryPage?category_id="+ID+"/"+NAME All the best.

于 2013-08-17T09:28:01.410 回答