4

I am currently working on a small web app and this is the first time i am using Struts2. Here is what i am trying to achieve.

A Struts2 JSP page on form post, calls a struts action. Once this action completes it task, I need to return to the calling JSP with out any page reloading (avoid postback). how can i achieve.can any one please help me?.

Roman C
  • 49,761
  • 33
  • 66
  • 176
edaklij
  • 4,121
  • 11
  • 31
  • 43

2 Answers2

5

It is called AJAX (no kidding).

In Struts2 you can use Struts2-jQuery Plugin to achieve that pretty easily.

Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
2

As AndreaLigios said, you can achieve this using struts-j query plug-in.

  1. Create a remote page to display your result.
  2. use <sj:sbmit targets="[div_id]" /> on your main page to submit the form
  3. Add a div to your main page to display the remote page. <div id="[div_id]" />

  4. In your struts.xml, just return the remote page as a result of your action.

Bhoomtawath Plinsut
  • 1,337
  • 1
  • 16
  • 31