Hi!
I am new to cocoon and xsp and logicsheets. I want to use a mail logicsheet
in order to display mails on a browser. I don't know exactly how to use this
logicsheet and how to handle the parameters.
I will attach the logicsheet and my xsp-file to show what I mean
exactly.Maybe I my xsp-file is completely wrong ?!
I would be very happy for an answer to my question!!!
mail logicsheet:
<xsl:template match="mail:execute-query">
<xsl:variable name="protocol">
<xsl:call-template name="get-nested-string">
<xsl:with-param name="content" select="mail:protocol"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="host">
<xsl:call-template name="get-nested-string">
<xsl:with-param name="content" select="mail:host"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="port"> <!-- POP3 is conventionally on port 110 -->
<xsl:call-template name="get-nested-string">
<xsl:with-param name="content" select="mail:port"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="username">
<xsl:call-template name="get-nested-string">
<xsl:with-param name="content" select="mail:username"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="password">
<xsl:call-template name="get-nested-string">
<xsl:with-param name="content" select="mail:password"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="mbox">
<xsl:call-template name="get-nested-string">
<xsl:with-param name="content" select="mail:mbox"/>
</xsl:call-template>
</xsl:variable>
<xsp:logic>
{
Properties _mail_properties = new Properties();
Session _mail_session =
Session.getDefaultInstance(_mail_properties,null);
<xsl:choose>
<xsl:when test="$protocol">
Store _mail_store = _mail_session.getStore(String.valueOf(<xsl:copy-of
select="$protocol"/>));
</xsl:when>
<xsl:otherwise>
Store _mail_store = _mail_session.getStore();
</xsl:otherwise>
</xsl:choose>
Integer _mail_port = null;
try {
_mail_port = new Integer(String.valueOf(<xsl:copy-of select="$port"/>));
} catch (Exception e) {}
_mail_store.connect(
String.valueOf(<xsl:copy-of select="$host"/>),
_mail_port == null ? -1 : _mail_port.intValue(),
String.valueOf(<xsl:copy-of select="$username"/>),
String.valueOf(<xsl:copy-of select="$password"/>));
Folder _mail_folder = _mail_store.getDefaultFolder();
_mail_folder = _mail_folder.getFolder(String.valueOf(<xsl:copy-of
select="$mbox"/>));
_mail_folder.open(Folder.READ_WRITE);
<xsl:apply-templates select="mail:results/*"/>
_mail_folder.close(false);
_mail_store.close();
}
</xsp:logic>
</xsl:template>
and this is my xsp-file:
<logic>
String POP3="POP3";
String localhost="localhost";
String portm="110";
String test="test";
String inbox="inbox";
</logic>
<content>
<mail:execute-query>
<mail:protocol>
<xsp:expr>POP3</xsp:expr>
</mail:protocol>
<mail:host>
<xsp:expr>localhost</xsp:expr>
</mail:host>
<mail:port>
<xsp:expr>portm</xsp:expr>
</mail:port>
<mail:username>
<xsp:expr>test</xsp:expr>
</mail:username>
<mail:password>
<xsp:expr>test</xsp:expr>
</mail:password>
<mail:mbox>
<xsp:expr>inbox</xsp:expr>
</mail:mbox>
</mail:execute-query>
</content>
---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>