You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by El...@tminus10.com on 2000/09/25 02:59:20 UTC

Form Processing in XML

Hello,

I am trying to find out if it's feasible to handle POST requests in an XML
file via XSP tags?

Basically, I want to write a form in XML(e.g. form.xml) with several fields
and a submit button where when the user updates the fields and hits the
button, the request is being forwarded to another XML file (e.g.
formsubmit.xml) and have formsubmit.xml to call a servlet, passing form
data to it.  The servlet would update the database with the new information
and send a status/message back to formsubmit.xml in XML format.
I am aware that I can forward the request from form.xml directly to servlet
but I dont' want that, since I dont' want the servlet to generate the whole
XML page.  That's why I am redirecting it to formsubmit.xml first to
include other contents needed for the page + the invocation of servlet and
its response.

I looked at FP taglibs and it seems like it does handle POST for forms but
through writing to a file whereas in my case, I want the data to go to a
servlet.

So, is what I am trying to accomplish feasible or am I approaching this all
wrong?

Any suggestion is greatly appreciated.

Thanks,
Eliza


Re: Form Processing in XML

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 17:59 -0700 24/09/00, Eliza.Khosrova@tminus10.com wrote:
>Hello,
>
>I am trying to find out if it's feasible to handle POST requests in an XML
>file via XSP tags?

Do you have to use a Servlet to do it?

Might it be possible for you to use ESQL TagLib to update the database?

You might be able to use the Request TagLib to feed your form values into
your ESQL Tags.

And wrap the whole thing in the FP <fp:if-post> tag to only do it during a
Form Submission.


Donald is the SQL expert, maybe he can comment on this.

regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

Re: Form Processing in XML

Posted by Michael Bierenfeld <mi...@atmiralis.de>.
Eliza.Khosrova@tminus10.com wrote:
> 
> Hello,
> 
> I am trying to find out if it's feasible to handle POST requests in an XML
> file via XSP tags?
> 
> Basically, I want to write a form in XML(e.g. form.xml) with several fields
> and a submit button where when the user updates the fields and hits the
> button, the request is being forwarded to another XML file (e.g.
> formsubmit.xml) and have formsubmit.xml to call a servlet, passing form
> data to it.  The servlet would update the database with the new information
> and send a status/message back to formsubmit.xml in XML format.
> I am aware that I can forward the request from form.xml directly to servlet
> but I dont' want that, since I dont' want the servlet to generate the whole
> XML page.  That's why I am redirecting it to formsubmit.xml first to
> include other contents needed for the page + the invocation of servlet and
> its response.
> 
> I looked at FP taglibs and it seems like it does handle POST for forms but
> through writing to a file whereas in my case, I want the data to go to a
> servlet.
> 
> So, is what I am trying to accomplish feasible or am I approaching this all
> wrong?
> 
> Any suggestion is greatly appreciated.
> 
> Thanks,
> Eliza
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


Hello,

you have several possibilities :

a) Submit the form into a servlet with <form
action="/servlets/HelloServlet" method="post" ...>

This has the disadvantage that you have to do all
processing in the Servlet :-)

b) Submit to an xml-page that uses xsp. In this
you can get all the values and do the further
processing.

I think the best solution is the following
(example) :

FileName : form.xml

    <form action=form.xml method=post ....>

This "posts" the form to itself, with the
following xsp-functionality

  <xsl:template match="form">

	<xsp:logic>

		<!-- Logic fuer die Seiten in general -->
		<!-- Hier kann beliebige Logik eingebaut werden
-->

		int procStatus = processor.processPage (
						<xsl:text>request</xsl:text>,
						<xsl:text>response</xsl:text>,
						<xsl:text>inputHash</xsl:text>,
						<xsl:text>engine</xsl:text>
							);

		if (procStatus == processor.SUCCESS) { .....

			// DO SOMETHING ELSE. Maybe a redirection or
error page. Whatever

		}

So depending on the submitted values and the
process results the response is redirected or an
error page is displayed.

Regards

Michael Bierenfeld