What happens if the action class returns null in struts?

What happens if the action class returns null in struts?

If it displays a page with zero jsp, then if you want to do something, how can we achieve this?

+4
source share
2 answers

If the action returns null, further processing / forwarding will not be performed, and the response will still be sent to the client.

Useful if you just want to send error answers or create output directly in action, rather than forward it to the view (which, of course, is not recommended for you).

If you want to display something, do not return null.

If the Struts code is somehow out of your control (but why this happens even if you don't want to touch the source, which could be a subclass, for example), I suppose you could set ServletFilter to add some extra post- treatment.

+5
source

I think that you can use AJAX calls to the server and populate the data in the client browser without reloading the page.

+1
source

All Articles