> I would like to make use of frames within my STRUTS application but am
> unsure how the framework handles frames.  For example, if I 
> have a form
> within a JSP page (form.jsp) and that page is presented to 
> the user within a
> frame (frame.jsp), how should I associate the ActionForm to 
> the form.jsp
> within the struts-config.xml file.  I want the app to navigate to the
> frame.jsp page but cannot associate the ActionBean to this 
> jsp as it does
> not have a form tag.  Is there a recommended solution ?

Not sure I fully understand but here goes...

When form.jsp starts generating the HTML for the form, it will look for
an ActionForm from which it can get default values. The name it will
use to look for this bean is defined in the struts-config.xml under the
Action to which you will be submitting the form. So the ActionForm name
is associated with the Action that receives it rather than the JSP that
generates it. So the fact that the JSP that generates it is wrapped
inside a frame isn't really an issue.

There are at least two other possible problems, though:

        1) If you want the previous Action to preload the ActionForm with
           some information (from a database, for example) you can do
           this by making your own ActionForm bean, filling it in, and
           then saving it in the session scope under the name which is
           declared in the Action that will receive it. It will then be
           found automatically when form.jsp generates the HTML.

        2) If you choose to automatically validate the ActionForm, you
           need to specify the "input" page so that Struts can
           automatically send you back there in case of an error. I don't
           have experience with this but you should be able to specify
           your frame.jsp file as the input source. When it then
           renders form.jsp within, this inner page will still find the
           ActionForm in the context if it were the highest level page.

Does that help?

Devon

Reply via email to