You are on page 1of 4

Each action is extending a base action, some implement preparable, but the method prepare is not implemented.

There is a logger declared in each Action class. In every action class there is an object array. The purpose of which it is used specifically in catching and displaying action errors and action messages. Every action class has an equivalent form, lets say action class has an equivalent action form. WelcomeAction has a WelcomeForm declared. There are getter and setter methods. There is a setSession(map) but no implementation yet. There is another init method in almost all the classes. In Welcome action classes there is nothing special, success is caught with an exception. How is an exception handled? A 2 array object is created. One object argument is assigned an exception message and another is assigned the error code. Log under info level the exception message. Get an equivalent error message from the properties file and assign the object array to it. The equivalent error message is formatted with String format method. Log the above message under the ERROR level. From the above message, extract the human readable error message using a message utility function, message is a string, identify the substring, like FrontEndContants.Details_Techniques. The FrontEndConstants contains a lot of error messages; you will have to pick those error messages. There is a utility message, addActionError and it adds a message. I do not know where the error message is added. It will return Struts ERROR string. In the catch Exception section CreateModifyCityAction If an action is dependent on a service it is declared and dependencies are injected using spring dependencies. There is a finalize method but it is not implemented. The dependency is provided with a constructor. There is a loading form. There is a finder variable and it might have been inherited, and it is initialized from FrontEndContants There is a getSessionForm in every action, it contains a context and we supply the key name to check whether the key is present, if it is, start Start the setting the properties of the form. Get the details from getSessionForm and return success. Else

Create an object argument of size 1. Assign the argument with the constant. Create a message by getting the message code from FrontEndConstants. Use the utility method addActionError to add a message and return ERROR. Use the catch exception for the whole of the init method and create error message. Log the error as described in the beginning of the text. The init method is primary used for initializing the createModifyForm. While setting the setter and getter of createModifyForm, you set the variable with cityForm. While getting the info from getCreateModifyForm use the method getForm (Class.getName) How to create a new record? Using the createmodifyform reset it. Set the display to 0 And return success. If there is an error, use the method addActionError and return the ERROR struts constant. How to save? Use the try catch block again. Save the id selected in the session, Get session form and get ctx and set property #AD_Org_ID value to be assigned is from createmodifyform getidorgselected From createmodifyform obtain citybean and getcityid if it is 0 create new city else modify the existing city. If there is an error addActionError the message and return Struts ERROR Get the dto from getmapper map createmodifyform getbean and c_citydto class From getsessionform getctx get c_countryid ==null N=0 Else N=integer.parseint(getsessionform getctx getcountry)Set c_countryid in c_Citydto Similary get cregionid Finally consumption of service: Use the citysvco for service, there is a method createCity (getSessionForm.getCtx,citydto,null) If(id<=0) Create an error message with the object array Else Create a single object array Assign the array to createmodifyform.getcitybean.getname Recovering the message Recovering the human message and finally addActionMessage(message) if there is an error, Modifycity

Dto creation from dozer Citysvo.updateC_city(getsesionform.getctx/citydto) Create an object array and print the message. CityForm extends kdampiereform There is a finalize method and super finalize is available There is a reference to city bean There are 2 map variables of city There sis a resetform and it will set the city bean to new citybean If getcitymap is not null it will clear it. In FindCityAction There is findform instead of createmodifyform There is a find method Create criteria: C_criteria ctr = (c_criteriamapper)getmapper.map(findform.getcitybean , c_citycriteriabean.class) Create a new arraylist and 2 maps Use getsessionform get string #AD_Client_id ==null Set m=0 Else Setad_client_id m Int l=0 Use getsessionform get ctx get #AD_Org_ID Set the criteria with #AD_Org_ID Use the be service citysvco.findc_city If(list=0) Log an error message Else Mapping dto vs bean C_citybean = getmapper map list.geti c_citybean.class Add bean to the result array list that we created earlier. Return success

You might also like