Ver Mensaje Individual
  #4 (permalink)  
Antiguo 09/08/2008, 17:04
Cimballi
 
Fecha de Ingreso: agosto-2008
Ubicación: Cajamarca
Mensajes: 49
Antigüedad: 15 años, 9 meses
Puntos: 0
Respuesta: Un Action se me ejecuta dos veces

Hola ElCrackdel83,

No tengo idea para tu problema, pero tengo comentarios sobre tu codigo. Voy a escribirlos en ingles, es mas facil para mi.

1. You should use the ActionFormBeans functionality of Struts instead of the following lines, it's more object oriented, and also more simple I think

long id_usuario = Long.parseLong(request.getParameter("id_usuario")) ;
String nombre = request.getParameter("nombre");
String apellidos = request.getParameter("apellidos");

http://struts.apache.org/1.3.8/userGuide/building_model.html#actionform

2. You should not call the DAO directly from your Actions, you should call Service classes instead. A Service class contains methods that merge calls to several DAO methods. And also you should not use static methods for the DAO.

UsuarioDao.deleteUser(id_usuario);

3. Also you should take care because in the case of your Action, someone can change the "id_usuario" by hand in the URL and so remove any user.

4. When you log at debug or info level, don't forget to put a Log.isDebugEnabled or Log.isInfoEnabled test, it can enhanced performance in production.

I hope this advices can help you !

Cimballi