how to jquery .load() from web-inf folder

2019-08-28 00:53发布

问题:

How would the url look if I'm trying to .load() a file in WebContent/WEB-INF/jsp/jsp2.jsp from a file in WebContent/js/jsFile.js

I've tried

"../WEB-INF/jsp/file.jsp"

"/WEB-INF/jsp/file.jsp"

"WEB-INF/jsp/file.jsp"

"/jsp/file.jsp"

"jsp/file.jsp"

Edit:

    $("#Submit").live({
        click: function(){
            $("#listView").fadeOut(1000, function(){
            });
            $("#screenView").load({
                url: "../WEB-INF/jsp/jspFile2.jsp",
                complete: function(){
                    alert("completed");
                }
            });
        }
    });

This is the code I'm using to load from WEB-INF/jsp/jspFile1.jsp.. It's not rendering the jspFile2.jsp in the screenView div as I was expecting..

the div screenView and listView are siblings.

Thanks,

wenn

回答1:

I think the first one you wrote is correct:

 "../WEB-INF/jsp/file.jsp"

if you post more info about the error and your code we could provide a more detailed answer (maybe the problem is different from what you think)



回答2:

../WEB-INF/jsp/file.jsp is correct, you must be having another problem. try redirecting the browser to the file and see if it shows up.