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 / create-empl.xsp < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  3.5 KB  |  101 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 xmlns:xsp="http://apache.org/xsp"
  19.           xmlns:xsp-formval="http://apache.org/xsp/form-validator/2.0"
  20.           xmlns:esql="http://apache.org/cocoon/SQL/v2">
  21. <document>
  22.   <header>
  23.     <title>Employee</title>
  24.   </header>
  25.   <body>
  26.     <s1 title="Create an Employee">
  27.       <form handler="create-empl.html">
  28.         <p>
  29.           You can create an employee by typing in the
  30.           name and pressing the "submit" button.
  31.         </p>
  32.         <p>
  33.           Name: <text name="name" size="30" required="true"/><br />
  34.       <xsp-formval:on-toosmall name="name">
  35.         Name must be at least 5 characters
  36.       </xsp-formval:on-toosmall>
  37.       <xsp-formval:on-toolarge name="name">
  38.         Name must be less than 64 characters
  39.       </xsp-formval:on-toolarge>
  40.     </p>
  41.         <p>
  42.           Department:
  43.           <select name="department">
  44.             <esql:connection>
  45.  
  46.               <!-- declare the connection pool we are using -->
  47.               <esql:pool>personnel</esql:pool>
  48.  
  49.               <!-- query execution blocks can be repeated -->
  50.               <esql:execute-query>
  51.  
  52.                 <!-- Find all departments and order them -->
  53.                 <esql:query>
  54.                   SELECT id, name
  55.                   FROM department ORDER BY name
  56.                 </esql:query>
  57.  
  58.                <!-- What to do with the results -->
  59.                 <esql:results>
  60.                   <!--
  61.                        A successful query that returns results
  62.                        executes this block.  You can also embed
  63.                        more "execute-query" blocks inside the
  64.                        row-results.  That way you can have queries
  65.                        that filter information based on the results
  66.                        of other queries.
  67.                   -->
  68.                   <esql:row-results>
  69.                     <option>
  70.                       <xsp:attribute name="value"><esql:get-string column="id"/></xsp:attribute>
  71.                       <esql:get-string column="name"/>
  72.                     </option>
  73.                   </esql:row-results>
  74.                   <!--
  75.                        Other result types are "no-results" and
  76.                        "error-results".  A successful query that
  77.                        does not return results (an empty resultset)
  78.                        will use the XML embedded in the "no-results"
  79.                        section.  An unsuccessful query that throws
  80.                        an exception will use the XML embedded in
  81.                        the "error-results" section.
  82.                   -->
  83.                 </esql:results>
  84.               </esql:execute-query>
  85.             </esql:connection>
  86.           </select><br/>
  87.       <xsp-formval:on-null name="department">
  88.         You must select a department
  89.       </xsp-formval:on-null>
  90.     </p>
  91.         <submit name="Create Employee"/>
  92.         <note>
  93.           * These fields are required.
  94.         </note>
  95.       </form>
  96.     </s1>
  97.   </body>
  98. </document>
  99. </xsp:page>
  100.  
  101.