开发者

Problem with receiving data from jsp to servlet

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜