简体   繁体   中英

Access Javascript array in Spring mvc controller

Right now I am sending some parameters through URL to the controller in spring mvc project. If the parameters are too long the url is more than 2083 characters which IE do not accept more than 2083 characters in a url.So I am thinking to access the front end JavaScript array in the backend controller. How is it possible or any other better alternative suggestion please?

It is not possible "to access the front end JavaScript array in the backend controller". The JavaScript array (and the logic around it) is in the browser, and your Java backend is on your server. The communication path are the URLs.

You're probably currently sending your parameters with GET requests. You have to switch to POST requests, then you'll be able to send much much more than 2000 characters.

See Spring docs section " Mapping Requests With @RequestMapping ", depending on the Spring version you use, eg:

Use POST instead of GET while making the call to the server side. And have your data in the payload of the request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM