cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yves Vindevogel <yves.vindevo...@implements.be>
Subject Re: Integrate javascript into xsp
Date Thu, 13 Mar 2003 09:49:24 GMT
Something like this ??
(I use it on body.onload, but it's the same for you)

<?xml version="1.0" encoding="ISO-8859-1"?>

    <xsp:page language="java"
    			xmlns:xsp="http://apache.org/xsp"
			xmlns:esql="http://apache.org/cocoon/SQL/v2"
			xmlns:xsp-request="http://apache.org/xsp/request/2.0"
			xmlns:xsp-session="http://apache.org/xsp/session/2.0"
			create-session="true">

        <html>

            <esql:connection>
                <esql:pool>pierrefabre</esql:pool>

                <esql:execute-query>
			<esql:query>
				select * from tblLogin
                                	where name = '<xsp-request:get-parameter 
name="username"/>'
                                 	and password = '<xsp-request:get-parameter 
name="password"/>' ;
			</esql:query>

                    <esql:results>
			<xsp-session:set-attribute name="user">admin</xsp-session:set-attribute>

		    	<body onload="window.location = './../frames.html'"></body>
                    </esql:results>

		    <esql:no-results>
		            	<head>
                			<link rel="stylesheet" type="text/css" 
href="./../css/pierrefabre.css"/>
                			<title>Pierre Fabre Médicament</title>
                                        <meta http-equiv="Content-Type" 
content="text/html; charset=ISO-8859-1"/>
			                <meta http-equiv="pragma" content="no-cache"/>
            			</head>

				<body class="homepage" onload="window.alert ('Mot de passe ou nom d' + 
'&quot;' + 'utilisateur ne sont pas corrects') ; window.location = 
'./../admin/password.html'">
				</body>
		    </esql:no-results>
                </esql:execute-query>

            </esql:connection>
	</html>
    </xsp:page>


If you need to call an extensive function, put it in your <head>
and put CDATA tags round it, like this

                                <script language="javascript">
                                <![CDATA[

				function ShowDiv(id)
                        	{
                                        //IE 4+
					if(document.all)
					{
						for (i = 1; i <= 4; i++)
                                		{
                                        		document.all.item("corner" + 
i).style.display = "none" ;
                                        		document.all.item("sub" + 
i).style.display = "none" ;
                                		} ;

                                		document.all.item("corner" + 
id).style.display = ""  ;
                                		document.all.item("sub" + id).style.display 
= "" ;
                                        }
					//NS 6
					else if (document.getElementById)
					{
                                        	for (i = 1; i <= 4; i++)
                                                {
							Element = document.getElementById("corner" + i);
							Element.style.display = "none";
							Element = document.getElementById("sub" + i);
							Element.style.display = "none";
       						}

                                                Element = 
document.getElementById("corner" + id);
                                                Element.style.display = "";
                                                Element = 
document.getElementById("sub" + id);
                                                Element.style.display = "";

					} ;


                                	return (false) ;
                        	}

                                ]]>
                                </script>





> Hi,
> I want to create a function on a button ("OnClick" action) that executes
> an SQL query. Is it possible to create a function (with xsp:logic) or
> something like that?
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

-- 
Met vriendelijke groeten,
Kind regards,
Bien à vous,

Yves Vindevogel

Implements
Kempische Steenweg 206  --  3500 Hasselt  --  Belgium
Phone/Fax: +32 (11) 43.55.76  --  Mobile: +32 (478) 80.82.91
Mail: yves.vindevogel@implements.be  --  www.implements.be

Quote: The winner never says participating is more important than winning.

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Mime
View raw message