struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Taylor, Jason" <jtay...@cobaltgroup.com>
Subject RE: Where's the form-bean???
Date Wed, 02 Oct 2002 21:04:33 GMT
I think I understand what you're doing, but feel free to ignore me if not.  

What I often do is to present "availXXX" object arrays to the front-end via
request/session attributes that the front-end developer knows is meant to be
a read-only "informational" array shared between different actions or action
forms as the case may be.  

These availXXX arrays are typically used to populate selection boxes or to
generate lists that are used as entry points into actions on specific items
in the availXXX array.  

The downside of my approach is you don't have the presence of the availXXX
arrays specified in the config file.  On the other hand, if you're running
into scenarios where you need the array even when the form isn't present,
this is something you could try...

-----Original Message-----
From: Lowe, Jeff [mailto:JLowe@CeltCorp.com]
Sent: Wednesday, October 02, 2002 1:35 PM
To: 'Struts Users Mailing List'
Subject: Where's the form-bean???


I'm using two select boxes to implement the user selection metaphor where
one contains "available choices", and the other contains "selected choices".

If the form does not pass validation, I need to repopulate the "selected
choices" from the array of its values, contained in the form bean.  This is
done in the action class that sets up all the data for the form.

After I submit and validation fails, Struts forwards back to the input url,
which is an action class.  The problem is that the form object passed into
perform() is null, so I can't get the array of values.  What has me vexed is
that after perform() forwards to the .jsp, all the form elements are
populated as they were prior to submit, so the populated form exists, it's
just not being passed in to perform().

I tried adding the name="formName" attribute to the mapping, but then Struts
tries to validate the form on the GET, as shown by the debug log below:

-Processing a GET for /standards/curriculum-coverage-form
-Looking for ActionForm bean under attribute 'curriculumCoverageReport'
-Creating new ActionForm instance of class
'...standards.CurriculumCoverageReportForm'
-Storing instance under attribute 'curriculumCoverageReport' in scope
'request'
-Populating bean properties from this request
-Validating input form properties
-No input form, but validation returned errors

Any insight into this would be greatly appreciated.  The mapping is shown
below.

Thanks,
-Jeff





<action path="/standards/party-resources-form"
        type="...standards.PartyResourcesReportAction"
        scope="request"
        parameter="form">
    <forward name="success"
             path="standards/party-resources-form.jsp"/>
</action>
<action path="/standards/party-resources-exec"
        type="...standards.PartyResourcesReportAction"
        name="partyResourcesReport"
        scope="request"
        parameter="exec"
        input="/standards/party-resources-form.action">
    <forward name="success"
             path="standards/party-resources-exec.jsp"/>
</action>


--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>

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