开发者

Problem with receiving data from jsp to servlet

开发者 https://www.devze.com 2023-03-10 09:34 出处:网络
I have problem with receive data from 开发者_运维知识库jsp to servlet. I know that I must serializes this data using JSON.

I have problem with receive data from 开发者_运维知识库jsp to servlet. I know that I must serializes this data using JSON. In my jsp in JavaScript I make something like this:

var myJSONText = JSON.stringify(items);
document.getElementById('test').value = myJSONText;

where, items is an array of JavaScript objects, and test:

<input type="hidden" name="test" id="test">

Now I want to receive this array on the servlet, I'm trying that (in method doPost()):

request.getParameter("test");

but it contains an empty value. Has anyone idea how to do it?


Can you show your code, when you do post request to server? Seems it should be something like

$.post('http:myurl.com', data)

or

<form ...>
<input type="submit">
</form>
0

精彩评论

暂无评论...
验证码 换一张
取 消