Struts Create an action for each independent request

xiaoxiao2021-03-05  21

How to learn from Javaeye today

If you don't like Struts's traditional processing mode, I hope that each request is handled with a separate Action object, so that you can: java code:

PUBLIC Abstract Class BaseAction Extends Action {Public ActionForward Execute (BaseAction Action = (BaseAction) this.getClass (). NewinStance (); Return Action.doExecute (...); }protace Abstract ActionForward Doexecute ();

Public class actiona extends baseAction {.....

Public actionforward doexecute (....) {............ Return mapping.findforward (.....);}}

This line does not interfere with each other.

Similarly, if you want to get REQUEST through ActionContext as WW2, don't have to get REQUEST through the method of passing, as long as you put an action in the Threadlocal in the baseAction, then write a secondary class similar to ActionContext can be implemented.

转载请注明原文地址:https://www.9cbs.com/read-38169.html

New Post(0)