0

So I have a function in a jsp file that uses a dialog to prompt a confirm or cancel message. I then call this function in another jsp page. This would obviously keep displaying the dialog on the first jsp because of the div tag call. So I thought the best way to display this dialog in both jsp's would be to pass in the div tag from each page into the function.

Question

Is it possible to use a function in one jsp, pass in a div tag from another so that it display on the jsp that the function is called on? And how?

function executeConfirmDelete(nodeUniqueId, pageId) {

    $( pageId ).dialog({
            buttons: [
                {
                    text: "Confirm",
                    "class" : "btn btn-primary button-width-medium",
                    click: function() {
                        $(this).dialog("close");
                        deleteLANode(nodeUniqueId);
                    }
                },
                {
                    text: "Cancel",
                    "class" : "btn btn-default",
                    click: function() {
                        $( this ).dialog( "close" );
                    }
                }
            ]
    });
    //basic css calls here and msgDialog string.

    $(pageId).dialog( "option", "title", "Confirm Delete Link" )
        .dialog("open")
        .html(msgDialog);

}
  • If you want information on one page to be sent to another page you'll have to store the information on your server. I recomment file_put_contents in php. The second page will call the contents. – Michael d Jan 11 '18 at 13:51
  • "dialog to prompt a confirm or cancel message" - this sounds like javascript, not JSP. Perhaps you should show some code to make your question clearer? – Stewart Jan 11 '18 at 14:51
  • So the pageId is the div from each jsp page – Higher Quality Jan 11 '18 at 15:30

0 Answers0