java - Send a parameter for every result -
i want send specific parameter every result.
struts.xml
:
<action name="modifierpara" method="modifierpara" class="ma.ensao.evalmetrics.view.parametrageaction"> <interceptor-ref name="loginstack" /> <result name="sscara"> <param name="etat">sscara</param> /web-inf/admin/projets/parametrer/modifiersubcara.jsp </result> <result name="metric"> <param name="etat">metric</param> /web-inf/admin/projets/parametrer/modifiermetric.jsp </result> </action>
depends on value of etat
, execute linkcontroller.modifier
different arguments.
ma.ensao.evalmetrics.view.parametrageaction
:
public class parametrageaction extends actionsupport { private static final long serialversionuid = 9149826260758390091l; private parametrage para; private long id; private paramanager linkcontroller; private string etat; private string etatsuivant; public parametrageaction() { linkcontroller = new paramanager(); } public string getspecificpara() { try { this.setpara(linkcontroller.getspecificpara(getid())); } catch (exception e) { e.printstacktrace(); } return success; } public string modifierpara() { try { if (etat.equals("cara")){ linkcontroller.modifier(para,"cara"); etatsuivant= "sscara"; }else if(etat.equals("sscara")){ linkcontroller.modifier(para,"sscara"); etatsuivant="metric"; }else if(etat.equals("metric")){ linkcontroller.modifier(para,"metric"); etatsuivant="success"; } } catch (exception e) { e.printstacktrace(); } system.out.println("coucouuuuu parm action"); return etatsuivant; } public long getid() { return id; } public void setid(long id) { this.id = id; } public paramanager getlinkcontroller() { return linkcontroller; } public void setlinkcontroller(paramanager linkcontroller) { this.linkcontroller = linkcontroller; } public static long getserialversionuid() { return serialversionuid; } public parametrage getpara() { return para; } public void setpara(parametrage para) { this.para = para; } public string getetat() { return etat; } public void setetat(string etat) { this.etat = etat; } }
to send parameter result need add parameter location
result
tag hold value of resource located dispatcher. add own params. example
<result name="sscara"> <param name="etat">sscara</param> <param name="location">/web-inf/admin/projets/parametrer/modifiersubcara.jsp</param> </result>
Comments
Post a Comment