doPost(e) does not return parameters but doGet(e) does?

后端 未结 3 1007
难免孤独
难免孤独 2021-01-06 23:59

Nowhere on the internet is this specific problem or a fix for it mentioned, so here goes:

My app contains the following doGet() and doPost()

3条回答
  •  被撕碎了的回忆
    2021-01-07 00:26

    I am having the same issue however. doGet(e) returns a parameters collection, but doPost(e) does not. Looking at the value e in the script log:

    DoGet logs this:

    {queryString=param1=value1¶m2=value2¶m3=value3, 
    parameter={param1=value1, param2=value2, param3=value3}, 
    contextPath=, 
    parameters={param1=[value1], param2=[value2], param3=[value3]},contentLength=-1}
    

    DoPost logs this:

    {queryString=lib=Ma1kfpb2uwfs976NQh3S0GV_Vnss8VuKo&appId=u33198874110&formId=xxxxxxxxxxxx&token=AJuLMu2XVXMgpvS-7l6mWLVDmxjYMA6ZEQ:1393694820550&gm1xs=&service=AKfycbzfP8gYQknL9dNG6SVf0LmPYy3xiEAtyFQ8AvJDwfs, 
    parameter={gm1xs=, lib=Ma1kfpb2uwfs976NQh3S0GV_Vnss8VuKo, appId=u33198874110, param1=value1, formId=u33198874111, token=AJuLMu2XVXMgpvS-7l6mWLVDmxjYMA6ZEQ:1393694820550, param2=value2, param3=value3, service=AKfycbzfP8gYQknL9dNG6SVf0LmPYy3xiEAtyFQ8AvJDwfs},
    contextPath=, contentLength=341}
    

    So in the doGet it is trivial to loop through e.parameters, but in doPost you must loop through e.parameter instead, and deal with the other parameters from the form that you don't care about.

提交回复
热议问题