Please read this article to understand what JSP is and how it operates, and why what you are asking is impossible.
Bear Bibeault wrote:P.S. If you need the result of a request while JSP is executing on the server, investigate the <c:import> tag.
Yes. This will do. I went through <import> tag description. But how do I use the result of AJAX (xmlhttp.responseText) in the imported page Must I use something like this ?
Bear Bibeault wrote:If you use <c:import> you won't be using Ajax.
Actually, 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 object in my custom tag. Is it possible to use c:import instead ?
Bear Bibeault wrote:<c:import> will simply grab whatever the response is. If it's JSON, then that's what you'll get.
At this point, just try it out.
Thanks for helping me out so far.
I understand how it works. But the point is I need to send elements from the form to the servlet.
The flow looks like this
First I contact servlet.
The above code will return me a JSON string. I need to use this JSON string and send it as parameter to my page like this
Please let me know how ?