Spring route question

Asked 2 weeks ago, Updated 2 weeks ago, 2 views

You have successfully clicked on a hyperlink in the parent window to open a pop-up window.

It works well when you turn it to Tomcat, but if you upload it to the server, you can't find the path.

It opens normally when local.

When uploaded to server, the requested resource [/one/daily/ListPopup] is not available appears.

Does the path change if I upload it to the server...?

Path-related code.

    @RequestMapping(value="/daily/ListPopup", method=RequestMethod.GET)
    public String popupGet(Model model) throws Exception {

        return "ListPopup";
    }
function aLink(cctv_id) {
    document.getElementById('cInput').value = cctv_id;
    console.log(document.getElementById('cInput').value);
    openWin = window.open("/two/daily/ListPopup", "_blank", "toolbar=use, menubar=yes, width=700, height=480").focus();
    openWin.document.getElementById('pInput').value = document.getElementById('cInput').value;
}

Why can't I find the path if I upload it to the server?

spring

2022-09-20 15:57

1 Answers

In the jsp file

<c:set var="path" value="${pageContext.request.contextPath}"/>

Add and

openWin = window.open("/two/daily/ListPopup", "_blank", "toolbar=use, menubar=yes, width=700, height=480").focus();

This part

openWin = window.open("${path}/daily/ListPopup", "_blank", "toolbar=use, menubar=yes, width=700, height=480").focus();

It's been fixed after you fixed it like this.


2022-09-20 15:57

If you have any answers or tips


© 2022 pinfo. All rights reserved.