Home » jquery » Struts2 Json and Jquery Example

Struts2 Json and Jquery Example

Here we will fetch a action variable’s value in jsp page using JSON and jquery
Here I am using struts 2.3.4 for that we have to include struts-2-json-plugin-2.3.4.jar in class path or include it to your lib folder if you are using any IDE.

Action class

In struts.xml we have to extend json-default and result type shold be json. No need to specify path inside <result &rt;</result<


Jsp page

Here we are using $.getJSON(‘test’, { name: name1}, function(data) method to fetch json data.

Managed by MochaHost - Fast & Easy WordPress Hosting