我想为每个结果发送一个特定的参数。
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>
取决于 的值etat
,我将linkController.modifier
使用不同的参数执行。
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 from 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;
}
}