Take a look at the auth taglib (http://ulim.cocoonhost.com/)
-----Message d'origine-----
> De : Brent L Johnson [mailto:[EMAIL PROTECTED]]
> Envoyé : vendredi 3 août 2001 00:07
> À : [EMAIL PROTECTED]
> Objet : [c1] xsp:logic compiling
>
>
> I'm fairly new to Cocoon - but I've been muddling through it
> now for a few
> days. But I'm hoping this isn't too big of a newbie
> question, but I didn't
> find any answers in the mailing list archives, the
> newsgroups, or the web.
>
> * Cocoon 1.8.2 with Tomcat
>
> I've created an XSL file which is working fine so far (it's a
> basic login)
> with it's XML instance document counterpart. When the user submit a
> login/pw form, it submits back to the same XML file (which in
> my case is
> index.xml). Here's a quick snip of the XSL code:
>
> <xsl:template match="page">
> <xsl:processing-instruction
> name="cocoon-process">type="xsp"</xsl:processing-instruction>
> <xsl:processing-instruction
> name="cocoon-format">type="text/html"</xsl:processing-instruction>
> <xsp:page language="java"
> xmlns:xsp="http://www.apache.org/1999/XSP/Core">
> <html>
> ....
>
> What I want to do is fairly simple. Check to see if the form has been
> submitted, by checking for the "login" parameter. So here is
> what I changed
> the code to:
>
> <xsl:template match="page">
> <xsl:processing-instruction
> name="cocoon-process">type="xsp"</xsl:processing-instruction>
> <xsl:processing-instruction
> name="cocoon-format">type="text/html"</xsl:processing-instruction>
> <xsp:page language="java"
> xmlns:xsp="http://www.apache.org/1999/XSP/Core">
> <xsp:logic>
> if (request.getParameter("login.x") == null) {
> <html>
> .... the rest of the HTML which shows the login form ....
> </html>
> } else {
> ... check username exists, etc
> response.sendRedirect("main.xml");
> }
> </xsp:logic>
>
> The problem seems to be how Cocoon is generating the java
> code. It seems as
> though if I put the <xsp:logic> tags before the <html> tag it
> puts the code
> outside of any method in the /* User Class Declarations */
> part which is, of
> course, not valid Java syntax if I'm doing an "if" statement.
>
> If I move the <xsp:logic> after the <html> tag my if
> statement goes into the
> populateDocument() method (which is OK - but after an HTML
> tag has been sent
> to the browser I can no longer redirect).
>
> Can anyone give me a suggestion on how I should handle the redirects??
>
> Also, how "full-featured" is Cocoon2? It looks as though C2
> has some nifty
> logicsheets for request and response objects (of which, by
> the way, it seems
> as though I can use the request logicsheet in C1 and
> <request:get-parameter>
> seems to still work fine... <response> on the other hand does
> not). With
> those logic sheets I could just use an <xsl:choose> on the
> parameter and
> then send the redirect.
>
> I'm working on a live site for a client though, so stability
> is an important
> issue.
>
> Anyways, any help would be appreciated, thanks,
>
> - Brent
---------------------------------------------------------------------
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]>