Hi Brian,

I think I've got a handle on the problem.

I have 2 mappings, a "setup" and a "submit".  When validation fails on
"submit" it forwards back to "setup".  The ActionForm was placed in the
request object by "submit", but "setup" knows nothing about it, nor should
it.

This is where the "attribute" attribute of the mapping comes into play.  I
can give it an "agreed-upon" name and then use that name to retrieve the
ActionForm when I need it.

Thanks,
-Jeff


-----Original Message-----
From: Brian Holzer [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, October 03, 2002 2:25 PM
To: Struts Users Mailing List' <[EMAIL PROTECTED]
Subject: RE: Where's the form-bean???


Hi Jeff,
    Is that because your Action is populating the form before forwarding to
the page?  And if not, what exactly is your Action doing?

Brian


>>> "Lowe, Jeff" <[EMAIL PROTECTED]> 10/03/02 07:22am >>>
Hi Jason, 

Thanks for the reply. You've got it right in what I'm doing. However I 
think I could describe the problem more simply. 

The problem is that when validation fails and I'm forwarded back to the 
Action specified by the mapping's "input" attribute, the form that is
passed 
in to Action.perform() is null. I'm puzzled because when the Action then

forwards to the .JSP page, all the form values are populated. 


Thanks, 
-Jeff 




-----Original Message----- 
From: Taylor, Jason [ mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 02, 2002 5:05 PM 
To: 'Struts Users Mailing List' 
Subject: RE: Where's the form-bean??? 


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:[EMAIL PROTECTED]] 
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:[EMAIL PROTECTED] > 
For additional commands, e-mail: 
< mailto:[EMAIL PROTECTED] > 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to