Problem rendering the form with Java framework

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem rendering the form with Java framework

Blue Rose
Hello,

I'm a newbie. I need info on how to tell my servlet to display the xform I created. For security reason, I purposely placed my xform under WEB-INF directory. Since I don't know how to display my xform from my servlet app (yet), I'm trying to access it using a simple HTML file for now.

FYI, I followed the guide on Orbeon Wiki (http://wiki.orbeon.com/forms/doc/developer-guide/xforms-with-java-applications) very closely but since I run my app and the xform both on the same context, I skipped the configuration on the application server, e.g. server.xml.

=======
test.html
=======

<html>
  <head></head>
  <body>
   <a href="resources/xforms">My xform</a><br />
  </body>
</html>

I went to access the page at http://localhost:8080/xform_context/test.html and clicked on the hyperlink, it appeared blank. Nothing was displayed. Tomcat log did not show any error messages either. From what it seemed, it looks like Tomcat didn't know how to render the xform correctly.

======
web.xml
======
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

  <display-name>Testing xforms</display-name>
  <description>Testing of sample hello-xforms</description>

    <!-- Declare and configure the Orbeon Forms XForms filter -->
    <filter>
        <filter-name>orbeon-xforms-filter</filter-name>
        <filter-class>org.orbeon.oxf.servlet.OrbeonXFormsFilter</filter-class>
        <init-param>
            <param-name>oxf.xforms.renderer.context</param-name>
            <param-value>/xform_context</param-value>
        </init-param>
    </filter>   

    <!-- This is necessary so that XForms engine resources can be served appropriately -->
    <filter-mapping>
        <filter-name>orbeon-xforms-filter</filter-name>
        <url-pattern>/resources/xforms/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>

</web-app>

==================
My webapp structure
==================
- xform_context
- test.html
- WEB-INF
- web.xml
- lib
- orbeon-xforms-filter.jar
- resources
- xforms
- page-flow.xml
- view.xhtml

=========
Environment
=========
Orbeon-3.7.1
Tomcat 5.5
Windows XP

Let me know if you need additional information from my end.

Any feedback would be greatly appreciated.


Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. Sign up now.

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Problem rendering the form with Java framework

Alessandro  Vernet
Administrator
You are on the right track, except that when using separate deployment, your form cannot be under WEB-INF. You can create a directory, say xforms, in your web app, and setup the application server  (Tomcat) to have all the requests that hit files in that directory processed by the Orbeon Forms filter. So for instance, the URL of one of your forms could be: http://www.example.com/myapp/xforms/myform.xhtml.

Since you have the filter setup, you don't need to worry about security in the sense that the files will always go through the filter before being sent to your users, and they will never see your XForms code (which could indeed contain things you don't want to expose).

Alex

On Jan 12, 2010, at 8:35 AM, Blue Rose <[hidden email]> wrote:

Hello,

I'm a newbie. I need info on how to tell my servlet to display the xform I created. For security reason, I purposely placed my xform under WEB-INF directory. Since I don't know how to display my xform from my servlet app (yet), I'm trying to access it using a simple HTML file for now.

FYI, I followed the guide on Orbeon Wiki (http://wiki.orbeon.com/forms/doc/developer-guide/xforms-with-java-applications) very closely but since I run my app and the xform both on the same context, I skipped the configuration on the application server, e.g. server.xml.

=======
test.html
=======

<html>
  <head></head>
  <body>
   <a href="resources/xforms">My xform</a><br />
  </body>
</html>

I went to access the page at http://localhost:8080/xform_context/test.html and clicked on the hyperlink, it appeared blank. Nothing was displayed. Tomcat log did not show any error messages either. From what it seemed, it looks like Tomcat didn't know how to render the xform correctly.

======
web.xml
======
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

  <display-name>Testing xforms</display-name>
  <description>Testing of sample hello-xforms</description>

    <!-- Declare and configure the Orbeon Forms XForms filter -->
    <filter>
        <filter-name>orbeon-xforms-filter</filter-name>
        <filter-class>org.orbeon.oxf.servlet.OrbeonXFormsFilter</filter-class>
        <init-param>
            <param-name>oxf.xforms.renderer.context</param-name>
            <param-value>/xform_context</param-value>
        </init-param>
    </filter>   

    <!-- This is necessary so that XForms engine resources can be served appropriately -->
    <filter-mapping>
        <filter-name>orbeon-xforms-filter</filter-name>
        <url-pattern>/resources/xforms/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>

</web-app>

==================
My webapp structure
==================
- xform_context
- test.html
- WEB-INF
- web.xml
- lib
- orbeon-xforms-filter.jar
- resources
- xforms
- page-flow.xml
- view.xhtml

=========
Environment
=========
Orbeon-3.7.1
Tomcat 5.5
Windows XP

Let me know if you need additional information from my end.

Any feedback would be greatly appreciated.


Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. Sign up now.

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





--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet