Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/08/2008, 02:08
ElCrackdel83
 
Fecha de Ingreso: julio-2008
Mensajes: 26
Antigüedad: 15 años, 9 meses
Puntos: 0
Respuesta: Un Action se me ejecuta dos veces

Cita:
Iniciado por Cimballi Ver Mensaje
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

Thank you so much! I'll consider properly your pieces of advice.

I know you are right. But I'm a new developer. It's still hard for me.

Thank you so much.

About the problem of executing twice my Action, I've read that it might be a bug.

I'll read more on the Internet.

Regards.