Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What will happen if action class returns the null in struts?

Tags:

struts

What will happen if action class returns the null in struts?

If it displays null jsp page,then if you want to diplay something how can we achieve it?

like image 430
user1550575 Avatar asked Jul 25 '12 05:07

user1550575


2 Answers

If the Action returns null, no further processing/forwarding will be done, and the response so far will be sent to the client.

Useful if you just want to send error responses, or create the output directly in the Action instead of forwarding to a view (which of course you are discouraged to do).

If you want to display something, don't return null.

If the Struts code is somehow beyond your control (but why would that happen, even if you don't want to touch the source you could subclass for example), I guess you could install a ServletFilter to inject some additional post-processing.

like image 101
Thilo Avatar answered Nov 18 '22 09:11

Thilo


I think one can take advantage of making AJAX calls to the server and populating data in client browser without reloading the page.

like image 1
coalmine Avatar answered Nov 18 '22 09:11

coalmine