struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mathieu Grimault" <grima...@presidence.univ-nantes.fr>
Subject multibox not resetting
Date Fri, 09 Apr 2004 11:36:03 GMT
 Hello !

Multibox made me crazy !! After having each problem detailled on the mailing
list i've got another not detailled...

I've got a jsp page with a multibox inside an iterate. the initial display
is correct and i can correctly retrieve the selected or unselected values
and, then write to the database some infos. The problem is when i come back
to the multibox page, the display doesn't take care of what has been changed
! Even if i call the reset method... Datas used by the reset method are
correct but it seems that the multiboxes are not been replaced. The only
solution i found is having a new session... where are placed the multibox ??
the form is request scoped...

I've noticed that reset is called at the first generation of the form and
when i leave the page but even if a forced it after i'm sure that it use
correct datas, it doesn't work.

The display is generated via the form's reset method with session scoped
datas written in page1 (see below).

how can i forcing the use of a totally new form ? Any solution ?

Best regards, mathieu.

scenario :

page1(request on the database) ---> page2 (with the multibox and writing to
the database) ---> page3 (confirmation and a link t page1)

Here are the problem :
struts-config.xml : -----------------------------------------------------
<action path = "/UnitesEnseignements"
type = "UnitesEnseignementsAction"
name = "UnitesEnseignementsForm"
scope = "request"
validate = "false"
input = "/jsp/unitesEnseignements.jsp"
>

jsp : -----------------------------------------------------
<logic:iterate name="unitesEnseignements" scope="session"
id="uniteEnseignement">
<tr>
<td>
<html:multibox property="valeurs">
    <bean:write name="uniteEnseignement" property="temoinSession2"/>
</html:multibox>
</td>
<td><bean:write name="uniteEnseignement" property="libelle"/></td>
</tr>
</logic:iterate>

form : -----------------------------------------------------

public void reset(ActionMapping mapping, HttpServletRequest request) {
    HttpSession session = request.getSession();
    ArrayList unitesEnseignements =
(ArrayList)session.getAttribute("unitesEnseignements");
    valeurs = new String[unitesEnseignements.size()];
    for(int i=0;i<unitesEnseignements.size();i++) {
        HashMap ligne = (HashMap)unitesEnseignements.get(i);

        if (((String)ligne.get("temoinSession2")).equals("O"))
            valeurs[i] = (String)ligne.get("code");
        }

        for (int i=0;i<valeurs.length;i++)
            System.out.println(valeurs[i]);
    }
}

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message