On 7/7/05, Andrew Tomaka <[EMAIL PROTECTED]> wrote:
> Hey all,
> 
> I'm attempting to create a JSP that is made up of two forms.  Each
> form needs a different form bean and is processed by a different
> action.  The catch is that the first form returns back to the JSP and
> the action responsible for this needs the name attribute set to the
> Form Bean of the first form.  When the JSP is loaded after the
> processing of the first form, both the form tags are assigned the name
> of the first Form Bean.
> 
> Is it possible to assign Form Beans to a form instead of assigning
> them to an action?
> 
> Thanks,
> ~ Andrew Tomaka

If you do not have prejudice against form bean with session scope, you
can use Struts Dialogs and create two JSP Controls. Each JSP Control
contains an action class and a form bean. For action class you either
can directly use DialogAction, or you may have to subclass it.

Include both controls (that is, their actions) into your JSP using
<jsp:include>. The submit request is sent directly to each control.
You need to set up action mapping for each control to set the
target/reload location. For the first control this would be you JSP
page, in which you embed the controls.

Struts Dialogs home page: http://struts.sourceforge.net/strutsdialogs
JSP control how-to:
http://struts.sourceforge.net/strutsdialogs/dialogaction-logincontrolsample.html
Live demo of JSP control:
http://www.superinterface.com/strutsdialog/embeddedmasterpage-tomcat.do

In the live demo the "Sign In" box is a JSP control.

The catch: if you use Tomcat, you cannot forward from action to JSP to
render a control, Tomcat closes response writer right after forward.
So you would need to design forward to JSP in regular way, then run
your app, Jasper will generate Java source code for your JSP, then you
need to copy that source code to your project. See the samples, they
contain all needed code. This issue will be addressed in next SRV
spec. It is a little hassle, but result worth it ;)

Michael.

--

Dialogs for Struts
http://struts.sourceforge.net/strutsdialogs

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

Reply via email to