Hi, how can i implement Ajax in my existing struts Application? Thanks in Advance.

Showing Answers 1 - 3 of 3 Answers

Prashanth Reddy Yannam

  • Mar 1st, 2007
 

Hi,

You need to take care of one thing in using AJAX with Struts and the remaining things will be same as a normal web application.

When you send a request using AJAX, the corresponding Action class will be executed.
In normal scenario, we return a ForwardAction from the execute method which interns used to identify and display a view.

But in our case we should return 'null' from the execute method as we are not trying to reload the present page or redirect to other page.

We store the result of the action in HttpServletResponse and we use PrintWriter to send the result, as if we are writing a normal Servlet.

If we try to return a ActionMapping, it will throw a IllegalStateException as the output is already committed.


All the best.
Regards,
Prashanth

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions