How to set s:param value in Ajax success body in Struts 2

amor - muammar

How can I set s:param value in Ajax success body?

I load a data with Ajax call and I fetch it into datatable but when I want to set s:param value I can not get its value, below is my code:

 $.ajax({
        url: "dataPp",
        type: 'POST',
        dataType : 'JSON',
        success: function (res) {
            table = $('table#dttable1').DataTable();
            table.clear();
            $.each(res.dokpp, function(i, item){
                var json = res.dokpp[i];
                table.row.add(
                    [json["kodeDok"],
                    json["fileNameUi"],
                    json["depPenerbit"],
                    json["createdDate"],
                    json["tglBerlaku"],
                    json["tglKadaluarsa"],
                    json["urutRev"],
                    '<s:url var="prev" namespace="/mr" action="prevDasboard">'+
                        '<s:param name="file">'+json["fileName"]+'</s:param>'+
                    '</s:url>'+
                    '<a href="${prev}" class="btn btn-default btn-xs">preview</a>'
                ]);
                console.log(json["fileName"]);
            }); 
            table.draw();
        }
    });
amor - muammar

I fixed this with this code :

'<a href="mr/prevDasboard?file='+json["fileName"]+'" class="btn btn-default btn-xs">preview</a>'

I use html tag to create a href.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to insert a value into Set collection in Struts 2

From Dev

How to insert a value into Set collection in Struts 2

From Dev

How can I replace the entire HTML of a page, or its body content, via an AJAX call's success callback?

From Dev

How to assign output of s:date to a 'var'(s:set) in Struts 2

From Dev

Insert a Javascript value into struts2 param

From Dev

How to use ajax response list as struts2 iterator value?

From Dev

How to use ajax response list as struts2 iterator value?

From Dev

How to set a value in application scope in struts2?

From Dev

how to dynamically set the "value" attribute of url tag in struts2?

From Dev

Set default value for struts 2 autocompleter

From Dev

how to get random value in struts set tag

From Dev

How to Process Ajax Result (Struts2)

From Dev

How to get Ajax response in Struts2

From Dev

How to Process Ajax Result (Struts2)

From Dev

s:property not shown value Struts2

From Dev

s:property not shown value Struts2

From Dev

How to set default Tiles layout in Struts 2

From Dev

How to set Struts2 dropdown list value, using an iterator variable

From Dev

How to use $(this) on AJAX success?

From Dev

Struts2 success page not getting invoked

From Dev

Getting null value at Struts2 Action from ajax request

From Dev

Ajax request, how to call an other function than "success" one's?

From Dev

How can I use an if statement in a $.jQuery ajax post's success:?

From Dev

value set for modal don't display when it is set through ajax success function

From Dev

ajax success return value complicated

From Dev

PHP AJAX success value empty

From Dev

How to get checked value of checkbox in Struts 2 tag <s:checkbox> into action class

From Dev

How do I show elements of a Map's value (List of Objects) in a Struts 2 optgroup?

From Dev

How to pass a struts2 token via ajax without a form?

Related Related

  1. 1

    How to insert a value into Set collection in Struts 2

  2. 2

    How to insert a value into Set collection in Struts 2

  3. 3

    How can I replace the entire HTML of a page, or its body content, via an AJAX call's success callback?

  4. 4

    How to assign output of s:date to a 'var'(s:set) in Struts 2

  5. 5

    Insert a Javascript value into struts2 param

  6. 6

    How to use ajax response list as struts2 iterator value?

  7. 7

    How to use ajax response list as struts2 iterator value?

  8. 8

    How to set a value in application scope in struts2?

  9. 9

    how to dynamically set the "value" attribute of url tag in struts2?

  10. 10

    Set default value for struts 2 autocompleter

  11. 11

    how to get random value in struts set tag

  12. 12

    How to Process Ajax Result (Struts2)

  13. 13

    How to get Ajax response in Struts2

  14. 14

    How to Process Ajax Result (Struts2)

  15. 15

    s:property not shown value Struts2

  16. 16

    s:property not shown value Struts2

  17. 17

    How to set default Tiles layout in Struts 2

  18. 18

    How to set Struts2 dropdown list value, using an iterator variable

  19. 19

    How to use $(this) on AJAX success?

  20. 20

    Struts2 success page not getting invoked

  21. 21

    Getting null value at Struts2 Action from ajax request

  22. 22

    Ajax request, how to call an other function than "success" one's?

  23. 23

    How can I use an if statement in a $.jQuery ajax post's success:?

  24. 24

    value set for modal don't display when it is set through ajax success function

  25. 25

    ajax success return value complicated

  26. 26

    PHP AJAX success value empty

  27. 27

    How to get checked value of checkbox in Struts 2 tag <s:checkbox> into action class

  28. 28

    How do I show elements of a Map's value (List of Objects) in a Struts 2 optgroup?

  29. 29

    How to pass a struts2 token via ajax without a form?

HotTag

Archive