What is the diff between perform() and execute() method?

Showing Answers 1 - 24 of 24 Answers

Sharan

  • Apr 27th, 2006
 

As  per my understanding, both perform() and execute() is the same method with different names. The prior version of struts supported "validate() and Perform()" for your action class whereas the present versions supprots "validate() and Execute()" for validation and execution of the code.

  Was this answer useful?  Yes

If you implement non - http specific execute() method of Action class and to that Action class if you make http protocol specific request then this execute() method with convert the received ServletRequest, ServletResponse object into Http Secific and then internally calls perform() method.

Please reply me if you don understand ok.

  Was this answer useful?  Yes

satheesh kumar. sriramaneni

  • May 3rd, 2006
 

Ok, fine.

  Was this answer useful?  Yes

satheesh kumar. sriramaneni

  • May 3rd, 2006
 

Ok, fine. Actually perform() and execute() can do same tasks.In struts1.0, have performExecute() and sturts 1.1 have execute() for performing or executing business logic.

  Was this answer useful?  Yes

abdul

  • May 11th, 2006
 

execute method calls perform() internally

  Was this answer useful?  Yes

Kamal Lochan UBIQUE, Kolkata India

  • May 19th, 2006
 

The Struts base Action class has been modified with a new method called execute(), i.e. The perform() method has been deprecated in Struts 1.1.

The main difference between the two is that the execute() method declares that it throws java.lang.Exception, where as the earlier perform() method declared IOException and ServletException.

  Was this answer useful?  Yes

selva

  • Jun 15th, 2006
 

i am doing my M.C.A final yr project in struts frame work...

I couldn,t get it exactly...what u mean here...

also when the validate method in the formbean will be invoked and how the

parameters r set during its invokation...

  Was this answer useful?  Yes

venki

  • Jun 22nd, 2006
 

Hi,

The struts controller "ActionServlet" preprocess method calls the different methods before handling the request to the controller. It calls the follwoing methods to create, populate and validate the input data.

// Process any ActionForm bean related to this request
        ActionForm form =
            processActionForm(request, response, mapping);
        processPopulate(request, response, form, mapping);
        if (!processValidate(request, response, form, mapping)) {
            return;
        }

  Was this answer useful?  Yes

Raja Pattanayak

  • Aug 10th, 2006
 

Actually,i am a beginner of struts.Can someone tell me about the validator framework in struts?tell me according to coding

  Was this answer useful?  Yes

Raghavendra Prasad

  • Nov 9th, 2006
 

hi,

 please reply my question as possible as early.

  Was this answer useful?  Yes

surendra

  • Apr 18th, 2007
 

Hi all,

Struts 1.0 uses Perform method where as struts 1.1 uses Execute method.

On using perform method, we can only catch servlet exceptions.

where as using execute method, all type of exceptions can be caught using declarative
Exceptions available in struts 1.1.

Thank you

  Was this answer useful?  Yes

pdommara

  • Dec 10th, 2007
 

At Struts 1.1 ,  Added one feature i.e Declarative Exception Handling  where we can   throw any  user Definced exceptions. but Perform() mehtod is  allows us to throw IOException and ServletExcpetion . So  added  excute() which allows  us throw any Exceptions now.



  Was this answer useful?  Yes

The new method execte() is necessary because perform() method declares that it throws only IOException and ServletException. Due to the added declarative exception-handling functionality the framework needs to catch all instance of java.lang.Exception from Action class.

Instead of changing the method signature for the perform() method and breaking backward compatibility the execute method was added.



Thanks,
Vinay

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions