struts_02

11
There are six action classes: ----------- Action DispatchAction LookupDispatchAction IncludeAction ForwardAction SwitchAction In struts 1.2 the following three actions are added: -------- MappingDispatchAction LocaleAction DownloadAction Action class is available in org.apache.struts.action package When you extends action class you need to overwrite execute() method with following four parameters :--------- 1) ActionMapping 2) ActionForm 3) HttpServletRequest 4) HttpServletResponse For the entire application only one instance will be created for the Action class and the same instance will be accessed by multiple threads concurrently because of this we should not declare any instance variable inside the Action class which is going to store Client specific data. When you use action class as super class we need to write multiple java class for multiple requirements. In struts 1.0 Action class has perform() method instead of execute() method ,with the following signature :-------- Public ActionForward perform(AM,AF,H.S.R,H.S.R)throws ServletException, IOException { ---- ---- ---- ---- ---- } Patni Confidential Types of actions in struts Action NOTE: ---- when you have multiple Action classes inside the application, multiple instances will be created on the basis of one

Upload: phani

Post on 17-Aug-2015

215 views

Category:

Documents


2 download

DESCRIPTION

st

TRANSCRIPT

There are six action classes: ----------- Action DispatchAction LookupDispatchAction IncludeAction ForwardAction SwitchActionIn struts 1.2 the followin three actions are added: -------- !appinDispatchAction LocaleAction DownloadAction Action class is a"aila#le in or.apache.struts.action packae $hen %ou extends action class %ou need to o"erwrite execute&' (ethod with followin four para(eters :---------1' Action!appin2' ActionFor()' *ttpSer"let+e,uest-' *ttpSer"let+esponse For the entire application onl% one instance will #e created for the Action class and the sa(e instance will #e accessed #% (ultiple threads concurrentl% #ecause of this we should not declare an% instance "aria#le inside the Action class which is oin to store .lient specific data. $hen %ou use action class as super class we need to write (ultiple /a"a class for (ultiple re,uire(ents. In struts 1.0 Action class has perfor(&' (ethod instead of execute&' (ethod 1with the followin sinature :--------2u#lic ActionForward perfor(&A!1AF1*.S.+1*.S.+'throws Ser"let3xception1 I43xception5---- ---- ---- ---- ----6It was deprecated in struts 1.1 #ecause of followin reasons : --------- 2erfor(&' (ethod is throwin Ser"let3xception1 I43xception 1 when %ou are o"erridin that in su# class %ou can throw onl% S.3 and I43 and its su# classes. It should not throw an% other new 3xception whereas in the case of execute&' (ethod we can throw an% kind of exception #ecause its (ethod le"el exception is /a"a.lan.3xception. It is a"aila#le in or.apache.struts.action packaePatni ConfidentialTypes of actions in strutsActionNOTE: ---- when %ou ha"e (ultiple Action classes inside the application1 (ultiple instances will #e created on the #asis of one instance for the one class.DispatchAction DispatchAction pro"ides the facilit% to roup the si(ilar functionalit% into sinle /a"a class instead of writin (ultiple /a"a classes for (ultiple re,uire(ents.Usage: ---------In JSP7ht(l:for( action89:search.do ; hello8search9