RE: Re: Re: XForms in a portlet

Posted by Stian Sigvartsen on
URL: https://discuss.orbeon.com/XForms-in-a-portlet-tp3010369p3013852.html

Message
Hi Maria
 
You appear to have an identical setup and are experiencing an identical problem to what I have been attempting to resolve.
 
The reason why you are just getting "a block of words" is because the OrbeonPortletXFormsFilter currently has a bug in it when used in conjunction with .jsp content like you described.
Essentially the filter believes there is no content, so what you're seeing in Liferay is the actual XForms mark-up which the filter should have converted into pure HTML/JavaScript.  (view the Liferay page source to see what I mean)
 
I've been able to work around this by simply not using .JSPs.  Instead I've written my portlet to read in a {someform}.xhtml file and write() this to the Portlet's RenderResponse like this:
 
File includeFile = new File(getPortletContext().getRealPath("/html/orbeontestxformportlet/someform.xhtml"));     
FileReader includeFileReader = new FileReader(includeFile);         
PrintWriter respWriter = renderResponse.getWriter();
int byteInt;
while((byteInt = includeFileReader.read()) != -1) {
 respWriter.write(byteInt);

Hope this is a viable workaround for you too, until the underlying issue with Orbeon is fixed.
This issue was recently documented in the Wiki @ http://wiki.orbeon.com/forms/doc/developer-guide/xforms-separate-deployment-with-portlets (See "Limitations" section)
 
P.S. If you discover a way of using .JSP output then I'd be very interested in hearing how you did it as this is a long term requirement for me too.
 
- Stian
-----Original Message-----
From: María Gil [mailto:[hidden email]]
Sent: 26 October 2010 15:34
To: [hidden email]
Subject: [ops-users] Re: Re: XForms in a portlet

Thanks, Erik.

I am using a nightly build (yesterday's, I think). I have deployed it in /jboss-home/server/default/deploy. I've tested Orbeon Form Builder, and it is working properly (I am able to create new forms, etc...)

On the other hand, I create a Liferay portlet (with Liferay SDK in Eclipse). I include orbeon-xforms-filter.jar in /lib. I edit portlet.xml, with this:

</portlet>
    <!-- Define the Orbeon portlet XForms filter (for handling XForms within your own portlets) -->
    <filter>
        <filter-name>orbeon-forms-portlet-xforms-filter</filter-name>
        <filter-class>org.orbeon.oxf.portlet.OrbeonPortletXFormsFilter</filter-class>
        <lifecycle>RENDER_PHASE</lifecycle>
        <lifecycle>ACTION_PHASE</lifecycle>
        <lifecycle>RESOURCE_PHASE</lifecycle>
    </filter>

    <!-- Map the Orbeon portlet XForms filter -->
    <filter-mapping>
           <filter-name>orbeon-forms-portlet-xforms-filter</filter-name>
        <portlet-name>hola</portlet-name>
</filter-mapping>
</portlet-app>


I also edit web.xml


<servlet>
        <servlet-name>orbeon-trampoline-servlet</servlet-name>
        <servlet-class>org.orbeon.oxf.portlet.OrbeonTrampolineServlet</servlet-class>
        <init-param>
            <param-name>oxf.xforms.renderer.context</param-name>
            <param-value>/orbeon.war</param-value>
        </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>orbeon-trampoline-servlet</servlet-name>
        <url-pattern>/xforms-trampoline</url-pattern>
    </servlet-mapping>


Do I need to change /xforms-trampoline/ ??

The third thing I need to do is enabling cross-context. I don't know if its here where I get the error. In Jboss, which is the best way to do so?  I've added

<Context path="/orbeon.war" docBase="orbeon" crossContext="true"/>
<Context path="/liferay.war" docBase="liferay" crossContext="true"/>



in /jboss-home/server/default/deploy/jboss-web.deployer/server.xml
my-app is in this case /liferay.war?

I want to display my form in view.jsp, so here I have my xhtml code, and I would like to see the form in my portlet, but it seems difficult. The only thing I see now, is just a block of words.

Can anyone help? I would be delighted with a bit of help...

Thank you and sorry for all these questions...

Best Regards,

María


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws