java - send parameter from request through json -
how can resend parameter received servlet servlet using json.
here's mean, using way pass parameters servlet
<a href="studentmanagementservlet?page=${page}&isactivated=${isactivated}" >
but now, wanna make using json, how can reach ${page}
, ${isactivated}
json?
jsp parses page before sends client, can use ${variables} anywhere in code, including inline in javascript.
to store them javascript object:
var obj = { page: ${page}, isactivated: ${isactivated} };
to store them json object:
var jsonobject = { "page" : "${page}", "isactivated": "${isactivated}" };
now, if want send different servlet, you'll need attach json objectto post request servlet.
unfortunately can't post requests anchor tag, you'll need either ajax call or form submit jsonobject 1 of values.
Comments
Post a Comment