rendered paste body/* * ClienteAction.java * * Created by Exadel Struts Studio */package demo;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import modelos.beans.cliente;import modelos.beans.juridico;import modelos.beans.natural;import modelos.dao.clienteDao;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;public class ClienteAction extends org.apache.struts.action.Action { // Global Forwards public static final String GLOBAL_FORWARD_getName = "start"; // Local Forwards private static final String FORWARD_sayhello = "sayhello"; public ClienteAction() { } public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ClienteActionForm cam = (ClienteActionForm) form; String tipo = cam.getTipo(); cliente clie = null; if (tipo != null && tipo.equals("natural")) { clie = new natural(cam.getNombres(), cam.getApellidos(), cam .getDireccion(), cam.getTelefonocasa(), cam .getTelefonotrabajo(), cam.getCelular(), cam.getEmail(), cam.getDni(), cam.getNota()); } else { clie = new juridico(cam.getNombres(), cam.getApellidos(), cam .getDireccion(), cam.getTelefonocasa(), cam .getTelefonotrabajo(), cam.getCelular(), cam.getEmail(), cam.getDni(), cam.getRuc(), cam.getNota()); } try { clienteDao.getInstance().Insertar(clie); } catch (Exception e) { e.printStackTrace(); } String greeting = "Hello, " + cam.getTipo() + "!"; request.setAttribute("greeting", greeting); return mapping.findForward(FORWARD_sayhello); }}