This is the action:
private ActionForward performeEdit(String myaction,
ActionMapping mapping, ActionForm actionForm,
HttpServletRequest request, HttpServletResponse response) {
try {
System.out.println("[performeDel] actionForm: " + actionForm);
FormBeanInputListado form = (FormBeanInputListado) actionForm;
System.out.println(" [performeDel] Instancia el DAO ");
ControlDAO controlDAO = new ControlDAO();
String buscar = null;
int cod = 0;
if(form != null){
cod = form.getTelcgid();
System.out.println("[performeDel] cod: " + cod);
}
if(cod != 0){
buscar = "WHERE TELCGID = " + cod ;
System.out.println("buscar: " + buscar );
}
List list = controlDAO.search(buscar, request);
System.out.println("listaAct.size(): " + list.size());
System.out.println(list.get(0).toString());
Directorio dic = (Directorio) list.get(0);
System.out.println(dic.getTeldsext());
request.setAttribute("listaAct", list);
}catch (Exception e) {
// e.printStackTrace();
System.out.println("e.toString(): " + e.toString());
generalError(request, e);
return mapping.findForward("fallo");
}
if (__log.isInfoEnabled()) {
__log.info(" [ControlAction] Forward: \"exito\"");
}
return mapping.findForward("exito");
}
and this is the formbean:
package directorio.controller;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
public class FormBeanInput extends ActionForm {
public final static int ADD = 1;
public final static int EDIT = 2;
public final static int LIST = 3;
private int strutsAction;
private int telcgid = 0;
private String teldsext = null;
private String teldsape = null;
private String teldsnom = null;
private int telcgidgrp = 0;
private String teldsnum1 = null;
private String teldsnum2 = null;
private int teldspis = 0;
private String teldscen = null;
private String depdsnm = null;
public void reset(ActionMapping mapping, HttpServletRequest request) {
// Reset values are provided as samples only. Change as appropriate.
telcgid = 0;
teldsext = null;
teldsape = null;
teldsnom = null;
telcgidgrp = 0;
teldsnum1 = null;
teldsnum2 = null;
teldspis = 0;
teldscen = null;
depdsnm = null;
}
public int getStrutsAction() {
return strutsAction;
}
public void setStrutsAction(int strutsAction) {
this.strutsAction = strutsAction;
}
public int getTelcgid() {
return telcgid;
}
public void setTelcgid(int telcgid) {
this.telcgid = telcgid;
}
public int getTelcgidgrp() {
return telcgidgrp;
}
public void setTelcgidgrp(int telcgidgrp) {
this.telcgidgrp = telcgidgrp;
}
public String getTeldsape() {
return teldsape;
}
public void setTeldsape(String teldsape) {
this.teldsape = teldsape;
}
public String getTeldscen() {
return teldscen;
}
public void setTeldscen(String teldscen) {
this.teldscen = teldscen;
}
public String getTeldsext() {
return teldsext;
}
public void setTeldsext(String teldsext) {
this.teldsext = teldsext;
}
public String getTeldsnom() {
return teldsnom;
}
public void setTeldsnom(String teldsnom) {
this.teldsnom = teldsnom;
}
public String getTeldsnum1() {
return teldsnum1;
}
public void setTeldsnum1(String teldsnum1) {
this.teldsnum1 = teldsnum1;
}
public String getTeldsnum2() {
return teldsnum2;
}
public void setTeldsnum2(String teldsnum2) {
this.teldsnum2 = teldsnum2;
}
public int getTeldspis() {
return teldspis;
}
public void setTeldspis(int teldspis) {
this.teldspis = teldspis;
}
public String getDepdsnm() {
return depdsnm;
}
public void setDepdsnm(String depdsnm) {
this.depdsnm = depdsnm;
}
//@SuppressWarnings("deprecation")
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if ((teldsext == null) || (teldsext.length() == 0)) {
errors.add("input", new org.apache.struts.action.ActionError(
"error.input.required"));
} else if (teldsext.length() > 5) {
errors.add("input", new org.apache.struts.action.ActionError(
"error.input.toBig", "5"));
}
if ((teldsape == null) || (teldsape.length() == 0)) {
errors.add("input", new org.apache.struts.action.ActionError(
"error.input.required"));
}
if ((teldsnom == null) || (teldsnom.length() == 0)) {
errors.add("input", new org.apache.struts.action.ActionError(
"error.input.required"));
}
if (telcgidgrp == 0) {
errors.add("input", new org.apache.struts.action.ActionError(
"error.input.required"));
}
if ((teldsnum1 == null) || (teldsnum1.length() == 0)) {
errors.add("input", new org.apache.struts.action.ActionError(
"error.input.required"));
} else if (teldsnum1.length() > 11) {
errors.add("input", new org.apache.struts.action.ActionError(
"error.input.toBig", "11"));
}
if ((teldsnum2 == null) || (teldsnum2.length() == 0)) {
errors.add("input", new org.apache.struts.action.ActionError(
"error.input.required"));
} else if (teldsnum2.length() > 11) {
errors.add("input", new org.apache.struts.action.ActionError(
"error.input.toBig", "11"));
}
if ((teldspis == 0)) {
errors.add("input", new org.apache.struts.action.ActionError(
"error.input.required"));
}
if ((teldscen == null) || (teldscen.length() == 0)) {
errors.add("input", new org.apache.struts.action.ActionError(
"error.input.required"));
}
return errors;
}
}
I use another formbean for redirect the action it contains just the atribute that will pass the value to the other jsp.
Thanks for your help...