• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to use Delegates

 
Ranch Foreman
Posts: 275
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi All,

I am using Struts 1.2 since some months but I have never used delegates .

I have been asked asked to make a simple login app using Delegates and VO's .

I know that delegate class has an EventResponse perform() method ,where the response is decided..
and the delegate is set using a <set-property> tag in <action-mappings>
but I am not sure how to wire the complete app...


kindly help
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I doubt that whoever gave you this assignment intended such a narrow definition of "delegate". The Delegate or Business Delegate just refers to a class that presents a coarse-grain interface to the view layer and in turn calls more fine-grain methods on a business service. You can read more about it in the following link to Sun's Core J2EE patterns.

http://java.sun.com/blueprints/corej2eepatterns/Patterns/BusinessDelegate.html
 
Aniruddh Joshi
Ranch Foreman
Posts: 275
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Merril,

You are correct,I knew that deligates perform services for the view layer and use business related objects... I was confused with hte deligates used in my app here.

I have one more doubt..I read that struts framework has a component called ' RequestProcessor ' which I have never used during my learning period..
is it a best practice to use the RequestProcessor and its perform() or processRequest() method ..if yes, which part of my logic goes here

In the application I am working on, they have extended AJAXRequestProcessor and the

public DataHandler processRequest(....)
method takes of AJAX implemention and the perform() method handles events..
Should we always use these 2 methods in the architecture ?
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Request Processor class is by default called by ActionServlet class and process method of Request Processor is called for request processing.
You can extend this class to have some kind of filtering before the request is processed.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

is it a best practice to use the RequestProcessor and its perform() or processRequest() method ..if yes, which part of my logic goes here



All Struts applications are always using the default Struts RequestProcessor. Using it is not considered a 'best practice.'

If you have requirements, and need to do address some functionality for each request, then you can create an application-specific sub-class of the default RequestProcessor
 
Aniruddh Joshi
Ranch Foreman
Posts: 275
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks James,

now I need to learn how to wire the extended RequestProcessor, I will get back to you in case of a problem.
 
Yeah, but is it art? What do you think tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic