which one is better??


Web tier: servlets, JSP, Web frameworks: which one is better??

  1. which one is better?? (4 messages)

    i am woring with a struts application.

     like add a employee and edit the employee and delete the record like.

      is it better to write one action class for all of the above actions or

     to write individual actions for individual ones..

    clearly tell me the relation between the performence and the number of action classes

    Threaded Messages (4)

  2. which one is better??[ Go to top ]

    Yous should user one form (EmplyeeForm) and more actions (AddEmployeeAction, EditEmployeeAction, GetEmployeeAction, DeleteEmployeAction). Extracting common logic in a BaseEmployeeAction might improve things.
    Best regards,Mircea
  3. Which is better[ Go to top ]


    Personally I would use one form but use DispatchAction or Lookup Action and only have one Action class. That way your code that is commonly used is in one place instead of the Action class with only execute method.
  4. Which is better[ Go to top ]

    Like Mircea, I prefer one Action class to do one thing and one
    thing only. You can put common stuff in a Base Action class as

    I'm not a big fan of the one Action class that does everything.
    It almost strikes me as the Magic Servlet anti-pattern.

    To each his own I guess.

    Jirawat Uttayaya
  5. Which is better[ Go to top ]

    Well, I disagree with that because you don't write a bean that simply gets your property. The action class should be within a simple business domain. CRUD (Create, Read, Update, Delete) operations all fall under one operation on an object. You don't create a different database object to read, one to update and one to delete.

    The multiple Action class thing that does CRUD operations just leads to more classes to maintain for no reason. But then again I'm not a believer in the Base Action either.