On Wed, 2004-04-28 at 21:14, JD Daniels wrote:
> Hi all,
>
> I want do soemthing like this from the samples:
>
> Flow:
>
> // also store the form as a request attribute as the XSP isn't
> flow-aware
> cocoon.request.setAttribute("form_model_gui", form.getWidget());
> cocoon.sendPage("form_model_gui-success-pipeline.xsp");
>
> XSP:
>
> <xsp:structure>
> <xsp:include>org.apache.cocoon.woody.formmodel.*</xsp:include>
> </xsp:structure>
> <p>
> <xsp:logic>
> // get reference to form and some of the widgets on it
> Form form = (Form)request.getAttribute("form_model_gui");
> Repeater repeater = (Repeater)form.getWidget("widgets");
> </xsp:logic>
>
> Repeater has <xsp:expr>repeater.getSize()</xsp:expr> row(s).
> </p>
>
> Using V2, I get a classCastException on Form form =
> (Form)request.getAttribute("form_model_gui");
>
> Anyone know why?
With V2, the object you get from form.getWidget() isn't the java Form
object itself but a javascript adapter for it. The real java form object
is also stored in a request attribute called "CocoonFormsInstance", so
doing:
Form form = (Form)request.getAttribute("CocoonFormsInstance");
in the xsp should work.
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED] [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]