You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Luda Balakireva <Lu...@envworld.com> on 2001/09/26 21:19:07 UTC

redirect

I am rewriting web application from coldfusion  to cocoon 2 -XSP .
I am trying to undestand how to control flow - redirects from sitemap.
I have login form where user inputs username and password ,so I submit it to
another page 
where I perform sql (via esql tags),depends on results of sql I want to
redirect user to diferent pages.
Since response object does not work,
Could you give me example how to do it (what to put in XSP page and siteMap)
, Thank you.


---------------------------------------------------------------------
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>


Re: redirect

Posted by Chris Newland <ch...@emorphia.com>.
Hi Luda,

You don't need to use redirects in Cocoon 2, you can do username and password authentication using actions.
This way you don't even need to write esql tags yourself.

The DatabaseAuthenticatorAction is the best one to use.

Make sure it is mapped in your sitemap's <map:actions> section:
<map:actions>
	<map:action name="authenticate" src="org.apache.cocoon.acting.DatabaseAuthenticatorAction"/>
	...
</map:actions>

Then you can use a match section like:

<!-- ====================================================================
This matcher authenticates the user.
======================================================================-->
<map:match pattern="page_after_login"> <!-- the form action is 'page_after_login' -->

	<!-- use the authenticate action to validate user login -->
	<map:act type="authenticate">
		<!-- Name the descriptor file that describes the database columns to compare -->
		<map:parameter name="descriptor" value="context://auth.xml"/>
		
		<!-- if the authenticate action succeeds then this section is executed -->
  		<map:generate type="serverpages" src="page_after_login.xsp"/>
   		<map:transform src="page2html.xsl"/>
		<map:serialize/>
	</map:act>

	<!-- if the authenticate action fails then this section is executed -->
   	<map:generate type="serverpages" src="login_failure.xsp"/>
   	<map:transform src="page2html.xsl"/>
   	<map:serialize/>

</map:match>

The auth.xml file that describes the database columns to compare will look something like:

<?xml version="1.0"?>

<auth>
  <connection>my_connection</connection>
  <table name="enduser">
	<select dbcol="username" request-param="username"/>
	<select dbcol="password" request-param="password"/>
  </table>
</auth>

You'll need to adjust the paths in the above sitemap example to suit your webapp structure.

Hope this helps,

Best Regards,

Chris




On Wednesday 26 September 2001 19:19, Luda Balakireva wrote:
> I am rewriting web application from coldfusion  to cocoon 2 -XSP .
> I am trying to undestand how to control flow - redirects from sitemap.
> I have login form where user inputs username and password ,so I submit it
> to another page
> where I perform sql (via esql tags),depends on results of sql I want to
> redirect user to diferent pages.
> Since response object does not work,
> Could you give me example how to do it (what to put in XSP page and
> siteMap) , Thank you.
>
>
> ---------------------------------------------------------------------
> 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>


---------------------------------------------------------------------
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>