Le lun 08/07/2002 à 11:39, Othman Haddad a écrit : > ok, > so can i associate an action with a submit button of an xsp page? > how can i do that,is there any precise sample or tutorial to advise? > thanks > othman Here is an example of use of 2 serverpages actions for authenticating the user and setting his default parameters
The pipeline : <map:match pattern="utlaut_act"> <!-- 1 Validation of the login and the password (utlcod and utlpwd) in the database --> <map:act type="xsp-action" src="utl/utlaut_act.xsp"> <!-- 2 Loading of basic user settings in his session --> <map:act type="xsp-action" src="utl/utlses_act.xsp"> <!-- By setting this parameter the serverpage will default to success --> <map:parameter name="output-attribute" value=""/> <!-- entrée dans la zone protégée --> <map:redirect-to uri="int"/> </map:act> </map:act> <!-- Portion of the sitemap executed if authentication failed --> <map:generate type="xsp" src="utl/utlaut_frm.xsp"/> <map:transform type="xslt" src="utl/utlauterr_frm.xsl"/> <map:serialize type="html"/> </map:match> The utlaut_act.xsp file : <?xml version="1.0" encoding="ISO-8859-1"?> <xsp:page xmlns:xsp="http://apache.org/xsp" xmlns:esql="http://apache.org/cocoon/SQL/v2" xmlns:log="http://apache.org/xsp/log/2.0" xmlns:xsp-session="http://apache.org/xsp/session/2.0" xmlns:xsp-request="http://apache.org/xsp/request/2.0" xmlns:action="http://apache.org/cocoon/action/1.0" create-session="true"> <page> <log:logger name="auth"/> <esql:connection> <esql:pool>srvdoc</esql:pool> <esql:execute-query> <esql:query> select utlnom from svprj_d001.utl where upper(utlcod) = '<xsp:expr><xsp-request:get-parameter name="utlcod"/>.toUpperCase()</xsp:expr>' and upper(utlpwd) = '<xsp:expr><xsp-request:get-parameter name="utlpwd"/>.toUpperCase()</xsp:expr>' </esql:query> <esql:results> <esql:row-results> <action:set-success/> <log:info>authentication succeeded.</log:info> <xsp-session:set-attribute name="utlnom"><esql:get-string column="tienom"/></xsp-session:set-attribute> </esql:row-results> </esql:results> <esql:no-results> <log:info>authentication failed.</log:info> <action:set-failure/> </esql:no-results> </esql:execute-query> </esql:connection> </page> </xsp:page> The utlses_act.xsp file : <?xml version="1.0" encoding="ISO-8859-1"?> <!--@ BCL le 21.06.02 Page d'initialisation d'une session --> <xsp:page xmlns:xsp="http://apache.org/xsp" xmlns:xsp-session="http://apache.org/xsp/session/2.0" xmlns:action="http://apache.org/cocoon/action/1.0"> <session> <xsp-session:set-attribute name="action">objrch</xsp-session:set-attribute> </session> </xsp:page> --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>