Passing javascript array to servlet

后端 未结 3 1399
清酒与你
清酒与你 2021-01-02 09:04

I have looked previous questions on this topic on SO, but my problem is not solved yet.

I am passing the array from javascript to servlet.

JavaScript Code:

相关标签:
3条回答
  • 2021-01-02 09:25

    you can just simply get the array with the name of the array...

    String actions[] = request.getParameterValues("action");

    0 讨论(0)
  • 2021-01-02 09:25

    You can't pass a java array as a parameter, as it is an structure. The best way is to serialize it into an string object like a jSon. You can use JSON.stringify. Simple and efficient. As you can serialize in the server also, it's very useful.

    0 讨论(0)
  • 2021-01-02 09:37

    Pass Javascript array variable with form action to send values to servlet, and then use

    String[] darray=request.getParameterValues("variable name used with link");
    
    0 讨论(0)
提交回复
热议问题