You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Noah Mittman <na...@mac.com> on 2002/02/15 01:24:25 UTC
maybe running Java within an XSL?
What would be the best way to approach this functionality?
I have an XML which acts as source data for a multi-framed web
application.
At some point I want a FORM in one of those HTML pages to send email --
take the to: and from: addresses but use a set of parameters which are
nodes in the XML.
So basically I want, upon submission, for Cocoon to take the parameters,
take the necessary nodes from the XML, send email via javax.mail, and
then style a result page based on the success/fail of the send, also
using parameters in the source XML.
Here's an example of what I'd thought I'd do:
a) Create an XSP by pulling in what is needed from the source XML and
the items from the FORM into a <xsp:page> root and a new <apputil:mail>
element:
<map:match pattern="sendmail.xsp"><!-- the action of the FORM -->
<map:generate src="sourcedata.xml" /><!-- our source data -->
<map:transform src="sourcedata-to-sendmail.xsl">
<map:parameter name="use-request-parameters" value="true"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
So a doc that is like this:
<source>
<name>Foo</name>
<style>bar.css</style>
<message>Thanks for making Foo #1 in Lichtenstein.</message>
</source>
Becomes this:
<xsp:page>
<apputil:mail>
<!-- form bits -->
<name>Foo</name>
<style>bar.css</style>
<message>Thanks for making Foo #1 in Lichtenstein.</message>
</apputil>
</xsp:page>
b) have apputil logicsheet ready, which will turn apputil:mail into a
<result> element
c) Execute the XSP and style the result
<map:match pattern="mail.xsp">
<map:generate type="serverpages" src="cocoon:/sendmail.xsp" />
<map:transform src="mail.xsl"/><!-- xsl logic based on the
result element -->
<map:serialize type="html"/>
</map:match>
It seems like it should be much easier than this, however. Is there a
better way?
Thanks!
n
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>