home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / process-department.xsp < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  2.4 KB  |  73 lines

  1. <?xml version="1.0"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17.  
  18. <xsp:page
  19.           language="java"
  20.           xmlns:xsp="http://apache.org/xsp"
  21.           xmlns:esql="http://apache.org/cocoon/SQL/v2"
  22.           xmlns:xsp-request="http://apache.org/xsp/request/2.0"
  23. >
  24.   <xsp:logic>
  25.     String process = null;
  26.     String name = null;
  27.     int currId = -1;
  28.   </xsp:logic>
  29.   <page>
  30.     <xsp:logic>
  31.       process = <xsp-request:get-parameter name="process"/>;
  32.       name = <xsp-request:get-parameter name="name"/>;
  33.     </xsp:logic>
  34.  
  35.     <resources>
  36.        <resource type="file" href="employee.xml?cocoon-view=pretty-content">Descriptor</resource>
  37.        <resource type="file" href="../transform/sql-page.xml.sql">Schema</resource>
  38.        <resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource>
  39.        <resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource>
  40.     </resources>
  41.  
  42.     <title><xsp:expr>process</xsp:expr> Department Processed</title>
  43.     <content>
  44.       <esql:connection>
  45.         <esql:pool>personnel</esql:pool>
  46.         <esql:execute-query>
  47.           <esql:query>
  48.         select max(id) as maxid from department
  49.       </esql:query>
  50.           <esql:results>
  51.         <esql:row-results>
  52.           <xsp:logic>
  53.                 currId = <esql:get-int column="maxid"/>;
  54.           </xsp:logic>
  55.               <esql:execute-query>
  56.                 <esql:query>
  57.                   insert into department (id, name) values (
  58.                     (<esql:parameter><xsp:expr>currId</xsp:expr></esql:parameter> + 1),
  59.                     <esql:parameter><xsp:expr>name</xsp:expr></esql:parameter>
  60.                   )
  61.                 </esql:query>
  62.               </esql:execute-query>
  63.         </esql:row-results>
  64.           </esql:results>
  65.         </esql:execute-query>
  66.       </esql:connection>
  67.  
  68.       <para><xsp:expr>name</xsp:expr> added</para>
  69.       <a href="../welcome">Back to the welcome page</a>
  70.     </content>
  71.   </page>
  72. </xsp:page>
  73.