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

ActionForm reset strategy

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • Nightly Build
    • 1.4.0
    • Core
    • None
    • Operating System: All
      Platform: All
    • 16107

    Description

      New attribute in <action> element where you can flag if you want the framework
      to call the reset() function of the ActionForm .
      It's very much like the "validate" attribute already present.

      This attribute would default to "true" for backward compatibility.

      Rationale:
      If you use checkboxes, you need to set the corresponding ActionForm property
      to "false" before the bean is populated from the request attributes (in the
      reset() method).
      But when you chain actions , you don't want this to happen (you would loose
      information).You want your bean to keep the info.

      Example:

      traceopen calls tracedetail on success -> show tracedetail.jsp
      tracesave calls tracedetail when validation fails (input attribute) -> show
      tracedetail.jsp

      tracedetail does some common things always needed for tracedetail.jsp (eg.load
      values for <select> tag from model).
      It should receive the ActionForm in the state it was in the calling action.

      <!-- Process a trace open for a new or existing trace -->
      <action path="/trace/traceopen"
      type="org.blabla.TraceOpenAction"
      name="traceForm"
      scope="request"
      reset="true">
      <forward name="success" path="/trace/tracedetail.do"/>
      <forward name="failure" path="/index.jsp"/>
      </action>

      <!-- prepare tracedetail.jsp resources -->
      <action path="/trace/tracedetail"
      type="org.blabla.TraceDetailAction"
      name="traceForm"
      scope="request"
      reset="false">
      <forward name="success" path="/trace/tracedetail.jsp"/>
      <forward name="failure" path="/index.jsp"/>
      </action>

      <!-- Process a trace save -->
      <action path="/trace/tracesave"
      type="org.blabla.TraceSaveAction"
      name="traceForm"
      scope="request"
      reset="true">
      input="/trace/tracedetail.do">
      <forward name="success" path="/trace/tracelist.do"/>
      <forward name="cancel" path="/trace/tracelist.do"/>
      </action>

      note:
      Can all be done by overriding ActionConfig.

      Attachments

        Issue Links

          Activity

            People

              pbenedict Paul Benedict
              j_cumps@yahoo.com removed
              Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: