掲示板
Encoding URL
Hi,
I want pass some values in resource url as format of Json.
Json contains values like getValue('var1') .
While retrieving i am facing some value some escape character need to add.
How to pass value like this in resource url.
Thank you in advance...
I want pass some values in resource url as format of Json.
Json contains values like getValue('var1') .
While retrieving i am facing some value some escape character need to add.
How to pass value like this in resource url.
Thank you in advance...
Hi Madhukara Patel,
Create resource URL :
Write Ajax to send data in JSON :
Now retrieve data in ServeResource Method :
HTH.
Regards,
Devang Patel
Create resource URL :
<portlet:resourceurl var="resourceURL">
</portlet:resourceurl>
Write Ajax to send data in JSON :
$.ajax({
url : '${resourceURL}',
data : data,//hospital id to sent
type: 'POST',
dataType : "json",
success : function(data) {
// get hospital data back from controller
}
});
Now retrieve data in ServeResource Method :
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) {
//get hospital id using getparameter
JSONObject json = JSONFactoryUtil.createJSONObject();
json.put("jsonData", "hospital details");
response.getWriter().write(json.toString());
}
HTH.
Regards,
Devang Patel