You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Sexton, Allane (ELS)" <a....@elsevier.com> on 2002/03/28 22:43:13 UTC

Error when success page is the SAME JSP - cannot find form bean

I'm building a struts application based on the struts example app.  Here's
the problem:

The user logs in.
The user is redirected to receipt.jsp which has an hmtl form.
The user fills out the form and hits submit.
---Everything is fine so far---
The ActionServlet validates everything.
BUT when the Action servlet redirects to the success page (which is the same
jsp - receipt.jsp) I get an exception thrown:

javax.servlet.ServletException: No bean found under attribute key
receiptForm

I have not been able to track down this problem or see why its happening.  I
redirect the user back to the same jsp because the user should be allowed to
use this form again after hitting submit.
The only work around I've been able to do is to redirect the user to a
different jsp and then the user can successfully reload the receipt.jsp page
again from there.  But this isn't a very ideal solution if the user needs to
use the form several times.  Is there a way to fix this problem??  Thanks.
Please find code snippets below: 

Here's a snippet from the struts-config.xml:
<action path="/saveReceipt"
            type="apple.action.SaveReceiptAction"
            name="receiptForm"
            scope="request"
            input="/receipt.jsp"
            validate="true">
        <forward name="failure" path="/receipt.jsp"/>
</action>

and a snippet from the log:

2002-03-28 16:26:15 action: Processing a POST for /saveReceipt
2002-03-28 16:26:15 action:  Looking for ActionForm bean under attribute
'receiptForm'
2002-03-28 16:26:15 action:  Recycling existing ActionForm bean instance of
class 'apple.form.ReceiptForm'
2002-03-28 16:26:15 action:  Populating bean properties from this request
2002-03-28 16:26:15 action:  Validating input form properties
2002-03-28 16:26:15 action:   No errors detected, accepting input
2002-03-28 16:26:15 action:  Looking for Action instance for class
apple.action.SaveReceiptAction
2002-03-28 16:26:15 action:   Double checking for Action instance already
there
2002-03-28 16:26:15 action:   Creating new Action instance
2002-03-28 16:26:15 action: SaveReceiptAction:  Processing Create action
2002-03-28 16:26:15 action:  Performing extra validations
2002-03-28 16:26:16 action: Forwarding to success page
2002-03-28 16:26:16 jsp: init
2002-03-28 16:26:16 ApplicationDispatcher[/apple] Servlet.service() for
servlet jsp threw exception
javax.servlet.ServletException: No bean found under attribute key
receiptForm

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>