Is it possible to write Struts Action class to render the part of the page with help of ajax without PrintWriter? I've heard that it's possible to do forward to the part of the page. For example it's solution with PrintWriter: http://www.raistudies.com/struts-1/ajax-with-struts-example/
Asked
Active
Viewed 822 times
2 Answers
1
Unfortunately not, since (if your ActionForward
doesn't redirect) your RequestProcessor
will take the URI
from the ActionForward
and forward it to the RequestDispatcher
.
So, you will need to return a null
forward after writing data to PrintWriter
.
I hope this helps.

Buhake Sindi
- 87,898
- 29
- 167
- 228
0
It depends on what your AJAX request expects in answer.
if it expects JSON/XML/other non-HTML stuff, then you should use
PrintWriter
to write that stuff to HTTP response.if it expects HTML content (inserts received content into your page), then you could forward from your action to JSP file, which will contain just the HTML fragment you want to return.

Victor
- 3,669
- 3
- 37
- 42