Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-2352

Strange value exchange between two formbeans.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Incomplete
    • 1.1.0
    • None
    • Unknown
    • None
    • Operating System: Windows XP
      Platform: PC
    • 33326

    Description

      Hello all,

      i have observed a strange situation. If i do an ActionForward from SampleAction1
      to SampleAction2 the formbean related to each Action exchange the values of the
      attributes that has the same name in both formbeans.

      example:

      // SampleAction1 / SampleForm1

      public final class SampleAction1 extends Action {
      public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception

      { HttpSession session = request.getSession(); SampleForm1 myForm = (SampleForm1) form; myForm.setSample("test"); return new ActionForward ("/sample2.do"); }

      public final class SampleForm1 extends ValidatorForm {

      private String sample = null;

      // RESET
      public void reset(ActionMapping mapping, HttpServletRequest request)

      { sample = null; }

      // GETTER / SETTER
      //...
      }



      // SampleAction2 / SampleForm2

      public final class SampleAction2 extends Action {
      public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception { HttpSession session = request.getSession(); SampleForm2 myForm = (SampleForm2) form; // ATTENTION // Now the value of sample in myForm(SampleForm2) is // "test" return new ActionForward ("/end.do"); }


      public final class SampleForm2 extends ValidatorForm {

      private String sample = null;

      // RESET
      public void reset(ActionMapping mapping, HttpServletRequest request) { sample = null; }

      // GETTER / SETTER
      //...
      }

      Although the reset() methode of SampleForm2 is called (i set a breakpoint) the
      value of the attribute sample is anyway "test" after the framework enters the
      method execute() of SampleAction2.

      Attachments

        Activity

          People

            Unassigned Unassigned
            nieke@softenergy.de Christian Nieke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: