Assign response text from AJAX to a JSP tag attribute
I know this question is similar to my previous question. I am making a AJAX request sending form values to a servlet which processes and sends me a JSON object as string. I am want to use that JSON ob开发者_如何转开发ject in my custom tag. How do I achieve this ? If its not possible with AJAX, what other alternatives have I got which prevents user from page refresh.
Custom tags are evaluated server-side, while ajax-requests are initiated from the browser. So you can't get a response from the server and use it in the tag evaluation.
Either add some javascript to the tag output which will handle the ajax response, or don't use JSON at all - since the tag is handled on the server you can get what you want without any serialization.
精彩评论