XmlEngine user s manual

Size: px
Start display at page:

Download "XmlEngine user s manual"

Transcription

1 XmlEngine user s manual 7 th April 2006 Revision 1.0 Visit us at

2 Table of Contents I.Introduction... 3 II.Requirements... 4 III.License... 5 IV.Installation... 6 V.System overview... 7 VI.Building XmlEngine from the sources VII.Example reports VII.1Example 1: Initial sample VII.2Example 2: Multiple queries VII.3Example 3: Sum and count functions VII.4Example 4: Defining the database driver and URL in the web.xml VII.5Example 5: Data grouping VII.6Example 6: Functions at different grouping levels VII.7Example 7: Using dynamic SQL queries VII.8Example 8: Using parameters VII.9Example 9: Changing attributes with parameters VII.10Example 10: Replacing a part of a value on an attribute VII.11Example 11: Using Boolean attributes VII.12Example 12: Creating subreports VII.13Example 13: More functions VII.14Example 14: the EQUAL function VII.15Example 15: Functions and fields format VIII.Application examples VIII.1Demo application without database VIII.2Demo application with a database connection XmlEngine_tutorial - Apr 7, /51

3 I.Introduction I. Introduction XmlEngine is a tool that produces forms and reports according to templates defined in XML, including FOP (Formatting Objects Processor), or HTML mark-up languages. These templates combined with a configuration file define the design of forms and reports and let users to have full control of how the information is organized and displayed. XmlEngine can be used as part of other applications, as we do in Openbravo ERP, or as a servlet as in the examples included in this manual. XmlEngine produces highly customized reports and has advanced report features such as headers and footers, data grouping and data functions. XmlEngine_tutorial - Apr 7, /51

4 II.Requirements II. Requirements Operating systems supported: Microsoft Windows XP, 2000 or 2003 server. Linux. It has been successfully tested in Red Hat and Fedora systems. To run XmlEngine, you need to install the following software: Jakarta-Tomcat version 5.5 or better. It can be downloaded from Additionally, if you also plan to build applications you need to install this additional software: Java 2 Platform Enterprise Edition 1.5 SDK or better. It can be downloaded from Additionally, if you also plan to build XmlEngine from the sources you need to install this additional software: Apache-ant 1.5. It can be downloaded from Operating systems supported: Microsoft Windows XP, 2000 or 2003 server. Linux. It has been successfully tested in Red Hat and Fedora systems. To run Openbravo, you need to install the following software: Jakarta-Tomcat version 5.5. It can be downloaded from Java 2 Platform Standard Edition 5.0. It can be downloaded from Oracle 10g release 2. It can be downloaded from Apache-ant 1.5. It can be downloaded from XmlEngine_tutorial - Apr 7, /51

5 III.License III. License The contents of this file are subject to the Openbravo Public License Version 1.0 (the "License"), being the Mozilla Public License version 1.1 with a permitted attribution clause; you may not use this file except in compliance with the License. You may obtain a copy of the License at Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Openbravo ERP. The Initial Developer of the Original Code is Openbravo SL All portions are Copyright (C) Openbravo SL All Rights Reserved. XmlEngine_tutorial - Apr 7, /51

6 IV.Installation IV. Installation This is a quick-start installation that explains how to install XmlEngine step by step: Make sure that you have installed all the required software from third parties (Tomcat) described in the requirements section of this document. Unzip the downloaded XmlEngine classes file and copy the files into your Tomcat directory. The examples can be executed using the following URL: webapps\xmlengine\example-urls.html that contains a list of URL to the different samples XmlEngine_tutorial - Apr 7, /51

7 V.System overview V. System overview XmlEngine can work as a servlet. There are few examples in this manual that describe in detail its features and possibilities when running in this mode of operation. The following table shows the output generated by a sample using XmlEngine as a servlet. Screen capture of an XmlEngine used as a servlet Hours of labour Employee Year Month Day Hours Johann Johann Peter Peter Peter Peter XmlEngine can also be integrated in external applications. In this scenario, it receives the input parameters from the application (such as a configuration file parameter) and returns an output string. It uses a configuration file and a template, but instead of building an SQL query, the data is taken from the application. Screen capture of an XmlEngine used by an external application XmlEngine_tutorial - Apr 7, /51

8 V.System overview Screen capture of an XmlEngine generated report XmlEngine needs two files to generate reports: An HTML/XML template file that contains the visual representation of how the data is displayed. An XML configuration file that contains the parameters needed to process the template correctly. The template can be created using any HTML editor, so the designer can work using a WYSIWYG (What You See Is What You Get) and see how the document looks instead of editing complex template files. This is a simple XML configuration file: <?xml version="1.0"?> <REPORT> <template file="example01.html" /> <structure name="structure1"> <CONNECTION driver = "org.apache.derby.jdbc.embeddeddriver" URL = "jdbc:derby:../webapps/xmlengine/web- INF/database/tutorialDB"/> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours </SQL> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <SECTION id="sectiondetail"/> </structure> <DISCARD id="example"/> </REPORT> XmlEngine_tutorial - Apr 7, /51

9 V.System overview These are some of tags commonly used in XmlEngine configuration files: The <report> tag indicates that the block that is going to be defined is a report definition. The <template> tag indicates through the file attribute which is the name of the template file that is used for this configuration file. The <connection> tag describes how the connection to the database is performed. The driver attribute indicates which database driver is used and the url attribute indicates the location of the database. This connection details can be also specified in the server configuration file. The <sql> tag indicates the SQL query that needs to be performed to get the data from the database. The <field> tag describes the mapping between the database fields and the templates are done. There are also some common tips and rules for creating XML configuration and HTML/XML template files: You can use the HTML <span> tag to place an id if there is no previous element to place it. The id attribute values on the document must be unique, so each element can be identified correctly. XmlEngine_tutorial - Apr 7, /51

10 VI.Building XmlEngine from the sources VI. Building XmlEngine from the sources To build XmlEngine from the sources, we need to compile the Java sources and move to the compiled Java classes to the XmlEngine Tomcat s context directory. A build.xml file for Ant is provided with the source distribution. Before executing Ant, check the initial parameters on the build.xml file are the correct for you configuration. XmlEngine_tutorial - Apr 7, /51

11 VII. Example reports In the following pages we are going to introduce some samples that show how to use XmlEngine as servlet and in an application. The examples have been developed using Derby database but they can be modified to use any database that has a JDBC driver. VII.1 Example 1: Initial sample In this first sample, we use a simple query to obtain a table that contains the hours worked by a group of different employees. Output of m example 1 Hours of labour Employee Year Month Day Hours Johann Johann Peter Peter Peter Peter Template file: example01.html <html> <head> <title>hours of labour</title> <META http-equiv="content-type" content="text/html" charset=iso "> </head> <body bgcolor="#ffffff" text="#000000"> <h1 align="center">hours of labour</h1> <table width="75%" border="1" align="center"> <tr> <td>employee</td> <td>year</td> <td>month</td> <td>day</td> <td>hours</td> </tr> <div class="sectiondetail"> XmlEngine_tutorial - Apr 7, /51

12 <tr> <td id="fieldemployee">xfrank</td> <td id="fieldyear">x2002</td> <td id="fieldmonth">x02</td> <td id="fieldday">x1</td> <td id="fieldhours">x8</td> </tr> </div> <div class="example"> <tr> <td>xjohann</td> <td>x2002</td> <td>x03</td> <td>x2</td> <td>x6</td> </tr> <tr> <td>xalfred</td> <td>x2002</td> <td>x03</td> <td>x4</td> <td>x8</td> </tr> </div> </table> </body> </html> Configuration file: example01.xml <?xml version="1.0"?> <REPORT> <template file="example01.html" /> <structure name="structure1"> <CONNECTION driver = "org.apache.derby.jdbc.embeddeddriver" URL = "jdbc:derby:../webapps/xmlengine/web- INF/database/tutorialDB"/> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours </SQL> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> XmlEngine_tutorial - Apr 7, /51

13 <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> <SECTION id="sectiondetail"/> </structure> <DISCARD id="example"/> </REPORT> In this example, the SQL sentence contained between <sql> tags obtains all the records of the Hours table: <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours </SQL> The mapping between fields and columns is described by the field tag as follows: <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> The first line indicates that the Employee column will we displayed in the field with id fieldemployee. The SQL query can return any number of records. For each one, the code of the template that is inside the <div> tag has the same identifier than the <section> tag of the configuration file. <SECTION id="sectiondetail"/> If there are more detail datas in the template than the strictly need these can be ignored from final result using the <discard> tag in the configuration file. <DISCARD id="example"/> This tag indicates that all lines in the template which are between tags with the same id of the <discard> tag are ignored. VII.2 Example 2: Multiple queries This example shows how multiple queries can be integrated in a single output document. XmlEngine_tutorial - Apr 7, /51

14 Output of example 2 Hours of labour Employee Year Month Day Hours Johann Johann Peter Peter Peter Peter Configuration file: example02.xml <?xml version="1.0"?> <REPORT> <template file="example02.html" /> <structure name="structure1"> <CONNECTION driver = "org.apache.derby.jdbc.embeddeddriver" URL = "jdbc:derby:../webapps/xmlengine/web- INF/database/tutorialDB"/> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours </SQL> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> <SECTION id="sectiondetail"/> </structure> <structure name="structure2"> <CONNECTION driver = "org.apache.derby.jdbc.embeddeddriver" URL = "jdbc:derby:../webapps/xmlengine/web- INF/database/tutorialDB"/> <SQL> XmlEngine_tutorial - Apr 7, /51

15 SELECT distinct Employee FROM Hours </SQL> <FIELD id="fieldemployee2">employee</field> <SECTION id="sectiondetailemployee"/> </structure> <DISCARD id="example"/> </REPORT> Each query is contained between a <structure> tag and can be performed on different databases. On the HTML/XML template document, there is a list of employees that refer to the elements of the new structure. Template file: example02.html <center> <h2>employees</h2> <ul> <div class="sectiondetailemployee"> <li id="fieldemployee2">xfrank</li> </ul> </center> VII.3 Example 3: Sum and count functions This example shows how sum and count functions work. Output of example 3 Hours of labour - 6 parts Employee Year Month Day Hours Johann Johann Peter Peter Peter Peter Total 38.0 Configuration file: example03.xml <?xml version="1.0"?> <REPORT> <template file="example03.html" /> XmlEngine_tutorial - Apr 7, /51

16 <structure name="structure1"> <CONNECTION driver = "org.apache.derby.jdbc.embeddeddriver" URL = "jdbc:derby:../webapps/xmlengine/web- INF/database/tutorialDB"/> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours </SQL> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> <SECTION id="sectiondetail"/> </structure> <structure name="structure2"> <CONNECTION driver = "org.apache.derby.jdbc.embeddeddriver" URL = "jdbc:derby:../webapps/xmlengine/web- INF/database/tutorialDB"/> <SQL> SELECT distinct Employee FROM Hours </SQL> <FIELD id="fieldemployee2">employee</field> <SECTION id="sectiondetailemployee"/> </structure> <DISCARD id="example"/> </REPORT> XmlEngine_tutorial - Apr 7, /51

17 In this example, we use the SUM and COUNT functions to perform operations on data retrieved from the database and include the results in the report. To use this kind of functionality, we use the <function> tag as shown below: <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> You can get also an average value instead of a sum using the MED function: <FUNCTION id="funcmedhours" name="med">hours</function> VII.4 Example 4: Defining the database driver and URL in the web.xml This example shows how to use define the driver and URL used to connect to the database in the initializing parameters of the XmlEngine servlet. Output of example 4 Hours of labour - 6 parts Employee Year Month Day Hours Johann Johann Peter Peter Peter Peter Total 38.0 The default database connection parameters can be setup in the web.xml file. For example, to indicate that we want to use the driver org.apache.derby.jdbc.embeddeddriver and the URL of the database is jdbc:derby:../webapps/xmlengine/web-inf/database/tutorialdb we add the following lines to the web.xml configuration file: <init-param> <param-name>driver</param-name> <paramvalue>org.apache.derby.jdbc.embeddeddriver</param -value> </init-param> XmlEngine_tutorial - Apr 7, /51

18 <init-param> <param-name>url</param-name> <param- value>jdbc:derby:../webapps/xmlengine/web- INF/database/tutorialDB</param-value> </init-param> Using this approach, there is no need to specify the connection details in our servlets. The following example uses the connection details specified in web.xml to perform the connection. Configuration file: Example04.xml <?xml version="1.0"?> <REPORT> <template file="list4.html" /> <structure name="structure1"> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours </SQL> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> <SECTION id="sectiondetail"/> </structure> </REPORT> Template file: example04.html <html> <head> <title>hours of labour</title> <meta http-equiv="content-type" content="text/html; charset=iso "> XmlEngine_tutorial - Apr 7, /51

19 </head> <body bgcolor="#ffffff" text="#000000"> <h1 align="center">hours of labour - <span id="funccountparts">xx2</span> parts</h1> <table width="75%" border="1" align="center"> <tr> <td>employee</td> <td>year</td> <td>month</td> <td>day</td> <td>hours</td> </tr> <div class="sectiondetail"> <tr> <td id="fieldemployee">xfrank</td> <td id="fieldyear">x2002</td&g; <td id="fieldmonth">x02</td> <td id="fieldday">x1</td> <td id="fieldhours">x8</td> </tr> </div> <tr> <td>total</td> <td colspan="4" id="funcsumhours" align="right">x34</td> </tr> </table> </body> </html> VII.5 Example 5: Data grouping This example shows how to use data grouping in our output reports allow grouping by different criteria. Output of example 5 Hours of labour - 6 parts Year: 2001 Month: 12 Employee Year Month Day Hours XmlEngine_tutorial - Apr 7, /51

20 Peter Total 5.0 Year: 2002 Month: 4 Employee Year Month Day Hours Peter Johann Total 14.0 Month: 5 Employee Year Month Day Hours Peter Peter Johann Total On the previous documents, there was just a section in the XML configuration file called sectiondetail. This section was repeated for each data record on the query. However, it is possible to have more than a section on a structure. The field attribute on the <section> tag indicates how the data is grouped. Notice from the output of this example that the sum function is now applied to each month. Configuration file: Example05.xml <?xml version="1.0"?> <REPORT> <template file="example05.html" /> <structure name="structure1"> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours ORDER BY ReportYear, ReportMonth </SQL> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> XmlEngine_tutorial - Apr 7, /51

21 <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> <SECTION id="sectionyear" field="reportyear"/> <SECTION id="sectionmonth" field="reportmonth"/> <SECTION id="sectiondetail"/> </structure> </REPORT> VII.6 Example 6: Functions at different grouping levels Total year: 5.0 This example shows how to combine functions and grouping. It computes a result per every year and then sums the results of all years. Total year: 33.0 Output of example 6 Hours of labour - 6 parts Year: 2001 Month: 12 Employee Year Month Day Hours Peter Total 5.0 Year: 2002 Month: 4 Employee Year Month Day Hours Peter Johann Total 14.0 Month: 5 XmlEngine_tutorial - Apr 7, /51

22 Total general: 38.0 Employee Year Month Day Hours Peter Peter Johann Total 19.0 Configuration file: Example06.xml <?xml version="1.0"?> <REPORT> <template file="example06.html" /> <structure name="structure1"> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours ORDER BY ReportYear, ReportMonth </SQL> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> <FUNCTION id="funcsumhoursyear" name="sum">hours</function> <FUNCTION id="funcsumhourstotal" name="sum">hours</function> <SECTION id="sectionyear" field= ReportYear /> <SECTION id="sectionmonth" field= ReportMonth /> <SECTION id="sectiondetail"/> </structure> </REPORT> XmlEngine_tutorial - Apr 7, /51

23 In the example 5 there was only a sum function. In this new example, there are two sum functions at different levels of the structure. Those operations perform sums per year and generate a total result. To include a sum per year it is necessary to define a new function in the XML configuration file: <FUNCTION id="funcsumhoursyear" name="sum">hours</function> In the template we have to include the id of this new sum between the blocks that enclose the <div> tags of the sections sectionmonth and sectionyear. <div class="sectionyear"> <h2 align="center">year: <span id="fieldyear">x2000</span><h2> Total year: <span id="funcsumhoursyear">xx10</span> <div id="sectionmonth"> If a general total result is also need it, we just need to insert another sum function in the XML configuration file: <FUNCTION id="funcsumhourstotal" name="sum">hours</function> The id of this sum must be placed out of the <div> tag of the sectionyear. In the HTML/XML template, the following line needs to be added: <h3>total general: <span id="funcsumhourstotal">xx10</span></h3> In the HTML file, the id is placed in a new <span> tag because there is no previous element that can be use to include it. VII.7 Example 7: Using dynamic SQL queries Total year: 5.0 This example shows how to use dynamic SQL queries. Until now the SQL queries that we used were static. XmlEngine can also work with dynamic SQL queries. This can be archived adding the argument name and its values to the URL address. Output of example 7 Hours of labour - 1 parts Year: 2001 Month: 12 XmlEngine_tutorial - Apr 7, /51

24 Total general: 5.0 Employee Year Month Day Hours Peter Total 5.0 Configuration file: Example07.xml <?xml version="1.0"?> <REPORT> <template file="example07.html" /> <structure name="structure1"> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours WHERE Year=? ORDER BY ReportYear, ReportMonth </SQL> <PARAMETER_SQL name = "year" type = "string" default = "2000" /> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> <FUNCTION id="funcsumhoursyear" name="sum">hours</function> <FUNCTION id="funcsumhourstotal" name="sum">hours</function> <SECTION id="sectionyear" field= ReportYear /> <SECTION id="sectionmonth" field= ReportMonth /> <SECTION id="sectiondetail"/> </structure> </REPORT> In the previous sample, we had the following XML configuration file: <SQL> XmlEngine_tutorial - Apr 7, /51

25 SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours WHERE Year=? ORDER BY ReportYear, ReportMonth </SQL> <PARAMETER_SQL name = "year" type = "string" default = "2000" /> <FIELD id="fieldemployee">employee</field> The <parameter_sql> defines dynamic SQL parameters. It accepts the following parameters: name: indicates the parameter on the query (as appears in the URL). type: the argument type: string or integer. default: the default value of the parameter in case it is not defined in the URL. For example: <PARAMETER_SQL name = "year" type = "string" default = "2000" /> The URL without arguments: XmlEngine.html?report=examples\example07 Returns no results in the output because the default value 2000 is used and there is no data for this year. However, if we use this URL: report=examples\example07&year=2001 It will correctly report the year 2001 report. VII.8 Example 8: Using parameters This example shows how to use parameters in a generated report from an URL. Output of example 8 Hours of labour - 6 parts Print Date: Employee Year Month Day Hours XmlEngine_tutorial - Apr 7, /51

26 Johann Johann Peter Peter Peter Peter Total 38.0 Configuration file: Example08.xml <?xml version="1.0"?> <REPORT> <template file="example08.html" /> <PARAMETER id="param1" name = "date" default=" "/> <structure name="structure1"> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours </SQL> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> <SECTION id="sectiondetail"/> </structure> </REPORT> It is possible to introduce a parameter on a report from an URL. It works as a parameter in the XML document and as a field in the HTML document, as in the other examples. Using <parameter> tag, the supported attributes are: id: identifies the place on the template where it will be shown name: Identifies the parameter on the query, it will appear on the URL. default: the default value of the parameter in case is not defined in the URL. XmlEngine_tutorial - Apr 7, /51

27 As we can see in this example template: <PARAMETER id= param1 name = "date" default=" "/> The default value for this parameter is "". The destination where the parameter will be written is indicated in the HTML document. We can invoke this example with this URL: report=examples\example08&date= VII.9 Example 9: Changing attributes with parameters This example shows how to use change the value of an attribute using parameters. Output of example 9 Hours of labour - 6 parts Print Date: Employee Year Month Day Hours Johann Johann Peter Peter Peter Peter Total 38.0 Configuration file: Example09.xml <?xml version="1.0"?> <REPORT> <template file="example09.html" /> <PARAMETER id="param1" name = "date" default=" "/> <PARAMETER id="funcsumhours" name = "cols" attribute="colspan"/> <structure name="structure1"> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours XmlEngine_tutorial - Apr 7, /51

28 </SQL> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> <SECTION id="sectiondetail"/> </structure> </REPORT> In previous examples we have seen how to change the tag value in the HTML document using <field>, <function> and <parameter> tags. Now, we are going to see how to change the value of an attribute. As example, we are going to use a parameter to indicate the number of columns that will be used in the total result cell. Currently, the line looks like: <td colspan="4" id="funcsumhours" align="right">x34</td> To change the colspan attribute using a parameter we add the following file in the XML configuration file: <PARAMETER id="funcsumhours" name = "cols" attribute="colspan"/> The name attribute is the name of the parameter that we have to include in the URL. To invoke the servlet, we use the following URL with the argument cols set to value 2: XmlEngine.html? report=examples\example09&date= &cols=2 We can see that the cell where the total is now only takes 2 columns. In this example it we have used the <parameter> tag but the same functionality is available in the <field> and <function> tags. XmlEngine_tutorial - Apr 7, /51

29 VII.10 Example 10: Replacing a part of a value on an attribute This example shows how to replace a part of a value on an attribute of an HTML tag. Output of example 10 Hours of labour - 6 parts Employee Year Month Day Hours Personal page Johann Personal page Johann Personal page Peter Personal page Peter Personal page Peter Personal page Peter Total 38.0 Sometimes there is the need to change the values of attributes. For example, to update a hyperlink. The following example is based on example4 and introduces a hyperlink that includes the employer name. We have to add another column to the table structure in the HTML document. Configuration file: Example10.xml <?xml version="1.0"?> <REPORT> <template file="example10.html" /> <structure name="structure1"> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours </SQL> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldpageemployee" attribute="href" replace="yy">employee</field> <FIELD id="fieldyear">reportreportyear</field> <FIELD id="fieldmonth">reportreportmonth</field> <FIELD id="fieldday">reportreportday</field> <FIELD id="fieldhours">hours</field> XmlEngine_tutorial - Apr 7, /51

30 <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> <SECTION id="sectiondetail"/> </structure> </REPORT> We add another column in the HTML/XML template document where the employee link is displayed: <td><a id="fieldpageemployee" href="xmlengine?report=examples/list12sub&employe e=yy">personal page</a></td> If nothing else is changed, the output will have as many rows as the data record has but all of them with the same hyperlink argument: code=yy. It is necessary to change the hyperlink argument, using the replace= yy attribute. Using this method, we have changed part of an attribute on the hyperlink tag, but we maintain another part. Change example10.xml near <field> to the following: <FIELD id="fieldpageemployee" attribute="href"replace="yy">employee</field> This line indicates that on each line, yy must be remplaced by the employee value where id= fieldpageemployee if yy is part of <href> tag attribute. We can invoke the example with the following URL: XmlEngine.html?report=examples\example10 If we click on the link we will obtain another page with the total hours worked by the employee. VII.11 Example 11: Using Boolean attributes This example shows how to use boolean attributes in reports. Output of example 11 Hours of labour - 6 parts Check Employee Year Month Day Hours Johann XmlEngine_tutorial - Apr 7, /51

31 Johann Peter Peter Peter Peter Total 38.0 Configuration file: Example11.xml <?xml version="1.0"?> <REPORT> <template file="example11.html" /> <PARAMETER id="paramyear" name = "checkyear" /> <structure name="structure1"> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours </SQL> <FIELD id="fieldcheckyear" boolean="checked" ithid="paramyear">reportyear</field> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> <SECTION id="sectiondetail"/> </structure> </REPORT> Unlike in HTML, XML requires a value for each attribute. For example, CheckOption only has an attribute when is checked but it does not when is not checked. We can indicate when a boolean attribute is true or not on the output using <field>, <function> and <parameter> tags. These tags accept the following attributes: attribute: identifies the attribute of the template. boolean: indicates the name of the attribute that will work as a boolean. XmlEngine_tutorial - Apr 7, /51

32 withid: The boolean attribute is only shown if both the attribute and the withid value match. Take the example 4. Imagine that we need to include a new column with a checkbox field and we only want to check the values that match with the year indicated on the URL. We will need to add the following line: <td> <input id="fieldcheckyear" type="checkbox" name="checkbox" value="checkbox" checked></td> We now have a new column with checkoptions. We can check the values from a specific year including a <parameter> tag in HTML/XML template file like follows: <PARAMETER id="paramyear" name = "checkyear" /> This allows the servlet to receive the checkyear argument from the URL. Now, we add the <field> elements: <FIELD id="fieldcheckyear" boolean="checked" withid="paramyear"> Year </FIELD> We can invoke the example with the following URL: XmlEngine.html? report=examples\example11&checkyear=2001 The output shows as checked all the records from VII.12 Example 12: Creating subreports This example shows how to create subreports in a report. Output of example 12 Hours of labour - 6 parts Employee Year Month Day Hours Total Johann Total hours 15.0 Johann Peter Peter Total hours Total hours Total hours XmlEngine_tutorial - Apr 7, /51

33 Peter Total hours 23.0 Peter Total 38.0 Total hours 23.0 In some XML documents we may need to insert another report in the XML document. It can be independent from the main report. Configuration file: Example12.xml <?xml version="1.0"?> <REPORT> <template file="example12.html" /> <structure name="structure1"> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours </SQL> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> <SECTION id="sectiondetail"/> <SUBREPORT id="reporttotalemployee" name="manual\list12sub" report="manual\list12sub"> <ARGUMENT name = "employee" withid="fieldemployee"/> </SUBREPORT> </structure> </REPORT> XmlEngine_tutorial - Apr 7, /51

34 We are going to take the example 4 as a starting point and add an additional column that shows a subreport with the hours worked by that employee. The subreport is contained in the files list12sub.xml and list12sub.srpt. To invoke the servlet we use the following URL: port=examples\example2sub&employee=peter And we obtain the following result: Total hours 23.0 In configuration file we add the next lines at the same level than <field>, <function> or <section> tags: <SUBREPORT id="reporttotalemployee" name="examples\example12sub" report="examples\example12sub"> <ARGUMENT name = "employee" withid="fieldemployee"/> </SUBREPORT> As you can see, we have inserted the <subreport> tag that accepts the following attributes: id: identifies the place on the template where it will be shown name: Identifies the parameter on the query, it will appear on the URL. report: the name of the file where is the subreport, the same way it is used in the URL call. The <argument> tag sends arguments to the subreport. In the subreport, we receive the <parameter> or <parameter_sql> tags. The <argument> tag accepts the following attributes: name: identifies the argument in the subreport; a parameter with the same name must exist in the report. withid: indicates where the value is obtained. The change in the HTML template file is the same than for the tags that replace a value (<field>, <function> or <parameter>). In this case a new column in the table is inserted adding at the end of the first table row the following line: <td>total</td> and at the end of the second table row the line: <td id="reporttotalemployee">xtotal</td> Notice that the value of this id is the same than that the id attribute of <subreport> tag in the configuration file. The same way that we have send a value XmlEngine_tutorial - Apr 7, /51

35 for a SQL parameter, it can be sent various parameters or receive the data in parameters just to show them. Subreport configuration file: example12sub.xml <?xml version="1.0"?> <REPORT> <template file="list12sub.srpt" /> <structure name="structure1"> <SQL> SELECT Sum(Hours) as sumhours FROM Hours WHERE Employee =? </SQL> <PARAMETER_SQL name = "employee" type = "string" default=" "/> <FIELD id="fieldhours">sumhours</field> <SECTION id="sectiondetail"/> </structure> </REPORT> Subreport template file: example12sub.srpt <table width="75%" border="1" align="center"> <tr> <td>total hours</td> <div class="sectiondetail"> <td id="fieldhours">x8</td> </div> </tr> </table> VII.13 Example 13: More functions This example shows how to use some additional functions. Output of example 13 Hours of labour - 6 parts Employee Year Month Day Month/Day Hours Minutes Johann Johann Peter Peter XmlEngine_tutorial - Apr 7, /51

36 Peter Peter Total 38.0 Configuration file: Example13.xml <?xml version="1.0"?> <REPORT> <template file="example13.html" /> <structure name="structure1"> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours </SQL> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> <PARAMETER id="param60" name="param60" default="60"/> <FUNCTION id="funcdivi" name="divide" arg1="fieldmonth" arg2="fieldday"/> <FUNCTION id="funcminutes" name="multiply" arg1="fieldhours" arg2="param60"/> <SECTION id="sectiondetail"/> </structure> </REPORT> In other examples we have seen the SUM, COUNT and MED functions. The only difference between those and DIVIDE, MOD, MULTIPLY, ADD is in the arguments they receive. On this example we use MULTIPLY and DIVIDE functions and we also add two new columns in the HTML template: <td>month/day</td> <td>minutes</td> XmlEngine_tutorial - Apr 7, /51

37 And for each row of data: <td id="funcdivi">x480</td> <td id="funcminutes">x480</td> In the XML document: <PARAMETER id="param60" name="param60" default="60"/> <FUNCTION id="funcdivi" name="divide" arg1="fieldmonth" arg2="fieldday"/> <FUNCTION id="funcminutes" name="multiply" arg1="fieldhours" arg2="param60"/> To invoke the servlet you can use the following URL: port=examples\example13 VII.14 Example 14: the EQUAL function This example shows how to use the equal function. Output of example 14 Hours of labour - 6 parts N. Employee Year Month Day Hours Accumulate 1.0 Johann Johann Peter Peter Peter Peter Total 38.0 Configuration file: Example14.xml <?xml version="1.0"?> <REPORT> <template file="example14.html" /> <structure name="structure1"> <SQL> XmlEngine_tutorial - Apr 7, /51

38 SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours </SQL> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> <FUNCTION id="funccounter" name="equal" arg1="funccountparts"></function> <FUNCTION id="funcacumulate" name="equal" arg1="funcsumhours"></function> <SECTION id="sectiondetail"/> </structure> </REPORT> The EQUAL function obtains counters and calculates accumulated sums in lists. For example, if we want to enumerate the lines of a list and have a column with the accumulated value we need to include two equal functions. <FUNCTION id="funccounter" name="equal" arg1="funccountparts"></function> <FUNCTION id="funcacumulate" name="equal" arg1="funcsumhours"></function> The first function calculates the actual value in the funccountparts function that indicates the line number. The second function represents the current value in the line of funcsumhours function. VII.15 Example 15: Functions and fields format This example shows how to use fields and functions. Output of example 15 Hours of labour - 6 parts XmlEngine_tutorial - Apr 7, /51

39 N. Employee Year Month Day Hours Accumulate 1 Johann Johann Peter Peter Peter Peter Total 38.0 Configuration file: Example15.xml <?xml version="1.0"?> <REPORT> <template file="example15.html" /> <structure name="structure1"> <SQL> SELECT Employee, ReportYear, ReportMonth, ReportDay, Hours FROM Hours </SQL> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> <FUNCTION id="funccounter" name="equal" arg1="funccountparts" format="integerinform"></function> <FUNCTION id="funcacumulate" name="equal" arg1="funcsumhours"></function> <SECTION id="sectiondetail"/> </structure> </REPORT> In the previous example the line number appears in decimal format. XmlEngine defines different formats to apply to output values. This can be XmlEngine_tutorial - Apr 7, /51

40 achieved with the format attribute of <field> and <function> tags. XmlEngine_tutorial - Apr 7, /51

41 VIII.Application examples VIII. Application examples VIII.1 Demo application without database This demo application shows an XmlEngine application that does not use a database connection. This example shows every category from a log4j configuration file, updating the selected items. In the following output you can see the categories and their priorities. You can use the user interface elements to change the selection. Screen capture of the Log4J demo application Log4j Demo We have an HTML file (SetPriority.html): <FORM METHOD=GET ACTION="#"> <SELECT NAME="priority" SIZE="5"> <OPTION value="debug" selected>debug</option> <OPTION value="info">info</option> <OPTION value="warn">warn</option> <OPTION value="error">error</option> <OPTION value="fatal">fatal</option> </SELECT> <INPUT TYPE="submit" value="priority Update"> <p> <TABLE> <TR> <TH>Category</TH> <TH>Priority</TH> </TR> <DIV id="sectiondetail"> <TR> <TD> <INPUT id="fieldcatval" TYPE="radio" NAME="category" value="x"> <SPAN id="fieldcategory">xcategory</span></td> <TD id="fieldpriority">xpriority</td> </TR> </DIV> </TABLE> </FORM> XmlEngine_tutorial - Apr 7, /51

42 VIII.Application examples We have an XML file (SetPriority.xml): <?xml version="1.0"?> <REPORT> <template file="setpriority.html" /> <structure name="structure1"> <FIELD id="fieldcategory">category</field> <FIELD id="fieldcatval" attribute="value">category</field> <FIELD id="fieldpriority">priority</field> <SECTION id="sectiondetail"/> </structure> </REPORT> The XML file (SetPriority.xml) is similar to the report generation XML files. The only difference is that it not a SQL query. We have a ServletSetPriority.java file. It shows de Log4j categories and it updates. import java.io.printwriter; import java.io.ioexception; import java.io.file; import javax.servlet.*; import javax.servlet.http.*; import org.openbravo.xmlengine.xmlengine; import org.openbravo.xmlengine.xmldocument; import org.apache.log4j.category; import org.apache.log4j.priority; import org.apache.log4j.propertyconfigurator; public class ServletSetPriority extends HttpServlet { public XmlEngine xmlengine=null; static Category log4jservletsetpriority = Category.getInstance(ServletSetPriority.class); public void init (ServletConfig config) { String prefix = config.getservletcontext().getrealpath("/"); PropertyConfigurator.configure(prefix+"WEB- INF/config/log4j.lcf"); xmlengine = new XmlEngine(); xmlengine.filexmlengineformat = new File (prefix+"web-inf/config/format.xml"); XmlEngine_tutorial - Apr 7, /51

43 VIII.Application examples xmlengine.filebaselocation = new File(prefix+"WEB-INF/classes"); xmlengine.initialize(); public void doget(httpservletrequest request, HttpServletResponse response) throws IOException, ServletException { dopost(request,response); public void dopost(httpservletrequest request, HttpServletResponse response) throws IOException, ServletException { String strcategory = request.getparameter("category"); String strpriority = request.getparameter("priority"); if (strcategory!= null && strpriority!= null) { Category category = Category.getInstance(strCategory); Priority priority = Priority.toPriority(strPriority); category.setpriority(priority); printpage(response); void printpage(httpservletresponse response) throws IOException, ServletException { log4jservletsetpriority.debug("output: Page"); response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); XmlDocument xmldocument = xmlengine.readxmltemplate("setpriority").createxm ldocument(); xmldocument.setdata("structure1",categorydata.getcategories()); out.println(xmldocument.print()+" v22"); out.close(); public String getservletinfo() { XmlEngine_tutorial - Apr 7, /51

44 VIII.Application examples return "Servlet that asign a priority to a Category"; We need to import several packages from the XmlEngine package: import org.openbravo.xmlengine.xmlengine; import org.openbravo.xmlengine.xmldocument; XmlDocument is a class that represents an XmlTemplate and XmlEngine is the class that represents the XmlEngine engine. The ServletSetPriority servlet extends HttpServlet. The init() function initializes an XmlEngine object. This object is later used in the printpage() function, where output string is generated: response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); After this, the SetPriority.xml file is read using the readxmltemplate function in the XmlEngine object. It returns an xmltemplate object which contains the template structure. Using this template the createxmldocument functions creates an XmlDocument object. XmlDocument xmldocument = xmlengine.readxmltemplate("setpriority").createxm ldocument(); Then we introduce the data in XmlDocument using setdata.java, reciving as an argument the structure name and the data object. xmldocument.setdata("structure1",categorydata.get Categories()); And, finally, it prints the output and passes to the PrintWriter: out.println(xmldocument.print()); out.close(); The setdata method from XmlDocument is the one who passes the data to XmlEngine, so this can later fill the template. The purpose of using a interface is to accept data from different sources. This interface is defined at FieldProvider: package org.openbravo.data; public interface FieldProvider { public String getfield(string fieldname); Every class that passes data to XmlEngine must have the getfield method, which has as argument the name of the field. The class used on this demo is CategoryData: import java.util.*; XmlEngine_tutorial - Apr 7, /51

45 VIII.Application examples import org.openbravo.data.fieldprovider; import org.apache.log4j.category; public class CategoryData implements FieldProvider { static Category log4jcategorydata = Category.getInstance(CategoryData.class); public String category; public String priority; public String getfield(string fieldname) { if (fieldname.equals("category")) return category; else if (fieldname.equals("priority")) return priority; else { log4jcategorydata.debug("no existe el campo: " + fieldname); return null; public static CategoryData[] getcategories() { Vector vector = new Vector(0); for (Enumeration e = Category.getCurrentCategories(); e.hasmoreelements() ;) { Category categoryitem = (Category)e.nextElement(); CategoryData categorydata = new CategoryData(); categorydata.category = categoryitem.getname(); if (categoryitem.getpriority()!= null) { categorydata.priority = categoryitem.getpriority().tostring(); vector.addelement(categorydata); CategoryData categorydata[] = new CategoryData[vector.size()]; vector.copyinto(categorydata); XmlEngine_tutorial - Apr 7, /51

46 VIII.Application examples return(categorydata); VIII.2 Demo application with a database connection Many applications obtain their data from a database. This demo shows how an application can access XmlEngine with data obtained data from a database. This sample uses a template and configuration files similar to the ones used on the fourth example. The configuration files looks like: Configuration file: hours4.xml <?xml version="1.0"?> <REPORT> <template file="list4.html" /> <structure name="structure1"> <FIELD id="fieldemployee">employee</field> <FIELD id="fieldyear">reportyear</field> <FIELD id="fieldmonth">reportmonth</field> <FIELD id="fieldday">reportday</field> <FIELD id="fieldhours">hours</field> <FUNCTION id="funccountparts" name="count">hours</function> <FUNCTION id="funcsumhours" name="sum">hours</function> <SECTION id="sectiondetail"/> </structure> </REPORT> The <template> tag indicates which template is used. The following servlet generates the same output that sample four but as an application. Configuration file: HoursList.java import org.openbravo.xmlengine.xmlengine; import org.openbravo.xmlengine.xmldocument; import java.io.*; import java.sql.*; import javax.servlet.*; XmlEngine_tutorial - Apr 7, /51

ServletConfig Interface

ServletConfig Interface ServletConfig Interface Author : Rajat Categories : Advance Java An object of ServletConfig is created by the web container for each servlet. This object can be used to get configuration information from

More information

SqlC tutorial. 12 th may Revision 1.0. Visit us at

SqlC tutorial. 12 th may Revision 1.0. Visit us at SqlC tutorial 12 th may 2006 Revision 1.0 Visit us at www.openbravo.com Table of Contents I. Introduction... 3 II. The Xml input file... 4 III. Executing SqlC... 5 IV. The output... 6 V. Types of methods...

More information

Web based Applications, Tomcat and Servlets - Lab 3 -

Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems Web based Applications, - - CMPUT 391 Database Management Systems Department of Computing Science University of Alberta The Basic Web Server CMPUT 391 Database Management

More information

The Basic Web Server CGI. CGI: Illustration. Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems 4

The Basic Web Server CGI. CGI: Illustration. Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems 4 CMPUT 391 Database Management Systems The Basic Web based Applications, - - CMPUT 391 Database Management Systems Department of Computing Science University of Alberta CMPUT 391 Database Management Systems

More information

Advanced Internet Technology Lab # 4 Servlets

Advanced Internet Technology Lab # 4 Servlets Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Advanced Internet Technology Lab # 4 Servlets Eng. Doaa Abu Jabal Advanced Internet Technology Lab # 4 Servlets Objective:

More information

Openbravo Oracle quick-start. installation guide

Openbravo Oracle quick-start. installation guide Openbravo Oracle quick-start installation guide 4rd January 2007 Revision 1.0.5 Visit us at www.openbravo.com Table of Contents I. Introduction...3 II. Requirements...4 III. License...5 IV. Operating Environment

More information

Servlets by Example. Joe Howse 7 June 2011

Servlets by Example. Joe Howse 7 June 2011 Servlets by Example Joe Howse 7 June 2011 What is a servlet? A servlet is a Java application that receives HTTP requests as input and generates HTTP responses as output. As the name implies, it runs on

More information

JAVA SERVLET. Server-side Programming INTRODUCTION

JAVA SERVLET. Server-side Programming INTRODUCTION JAVA SERVLET Server-side Programming INTRODUCTION 1 AGENDA Introduction Java Servlet Web/Application Server Servlet Life Cycle Web Application Life Cycle Servlet API Writing Servlet Program Summary 2 INTRODUCTION

More information

Openbravo quick-start. installation guide

Openbravo quick-start. installation guide Openbravo quick-start installation guide 25 th April 2006 Revision 1.0.2 Visit us at www.openbravo.com Table of Contents I. Introduction... 3 II. Requirements... 4 III. License... 5 IV. Operating Environment

More information

Openbravo r2.10 quick-start. installation guide

Openbravo r2.10 quick-start. installation guide Openbravo r2.10 quick-start installation guide 13 th July 2006 Revision 1.0.3 Visit us at www.openbravo.com Table of Contents I. Introduction... 3 II. Requirements... 4 III. License... 5 IV. Operating

More information

Java Enterprise Edition. Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1

Java Enterprise Edition. Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1 Java Enterprise Edition Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1 Java Beans Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 2 Java Bean POJO class : private Attributes public

More information

INTRODUCTION TO SERVLETS AND WEB CONTAINERS. Actions in Accord with All the Laws of Nature

INTRODUCTION TO SERVLETS AND WEB CONTAINERS. Actions in Accord with All the Laws of Nature INTRODUCTION TO SERVLETS AND WEB CONTAINERS Actions in Accord with All the Laws of Nature Web server vs web container Most commercial web applications use Apache proven architecture and free license. Tomcat

More information

Servlets1. What are Servlets? Where are they? Their job. Servlet container. Only Http?

Servlets1. What are Servlets? Where are they? Their job. Servlet container. Only Http? What are Servlets? Servlets1 Fatemeh Abbasinejad abbasine@cs.ucdavis.edu A program that runs on a web server acting as middle layer between requests coming from a web browser and databases or applications

More information

3. The pool should be added now. You can start Weblogic server and see if there s any error message.

3. The pool should be added now. You can start Weblogic server and see if there s any error message. CS 342 Software Engineering Lab: Weblogic server (w/ database pools) setup, Servlet, XMLC warming up Professor: David Wolber (wolber@usfca.edu), TA: Samson Yingfeng Su (ysu@cs.usfca.edu) Setup Weblogic

More information

AJP. CHAPTER 5: SERVLET -20 marks

AJP. CHAPTER 5: SERVLET -20 marks 1) Draw and explain the life cycle of servlet. (Explanation 3 Marks, Diagram -1 Marks) AJP CHAPTER 5: SERVLET -20 marks Ans : Three methods are central to the life cycle of a servlet. These are init( ),

More information

Servlet Fudamentals. Celsina Bignoli

Servlet Fudamentals. Celsina Bignoli Servlet Fudamentals Celsina Bignoli bignolic@smccd.net What can you build with Servlets? Search Engines E-Commerce Applications Shopping Carts Product Catalogs Intranet Applications Groupware Applications:

More information

Kamnoetvidya Science Academy. Object Oriented Programming using Java. Ferdin Joe John Joseph. Java Session

Kamnoetvidya Science Academy. Object Oriented Programming using Java. Ferdin Joe John Joseph. Java Session Kamnoetvidya Science Academy Object Oriented Programming using Java Ferdin Joe John Joseph Java Session Create the files as required in the below code and try using sessions in java servlets web.xml

More information

sessionx Desarrollo de Aplicaciones en Red A few more words about CGI CGI Servlet & JSP José Rafael Rojano Cáceres

sessionx Desarrollo de Aplicaciones en Red A few more words about CGI CGI Servlet & JSP José Rafael Rojano Cáceres sessionx Desarrollo de Aplicaciones en Red José Rafael Rojano Cáceres http://www.uv.mx/rrojano A few more words about Common Gateway Interface 1 2 CGI So originally CGI purpose was to let communicate a

More information

2. Follow the installation directions and install the server on ccc. 3. We will call the root of your installation as $TOMCAT_DIR

2. Follow the installation directions and install the server on ccc. 3. We will call the root of your installation as $TOMCAT_DIR Installing a Web Server 1. Install a sample web server, which supports Servlets/JSPs. A light weight web server is Apache Tomcat server. You can get the server from http://tomcat.apache.org/ 2. Follow

More information

Introduction. This course Software Architecture with Java will discuss the following topics:

Introduction. This course Software Architecture with Java will discuss the following topics: Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations

More information

CIS 3952 [Part 2] Java Servlets and JSP tutorial

CIS 3952 [Part 2] Java Servlets and JSP tutorial Java Servlets Example 1 (Plain Servlet) SERVLET CODE import java.io.ioexception; import java.io.printwriter; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet;

More information

Session 8. Introduction to Servlets. Semester Project

Session 8. Introduction to Servlets. Semester Project Session 8 Introduction to Servlets 1 Semester Project Reverse engineer a version of the Oracle site You will be validating form fields with Ajax calls to a server You will use multiple formats for the

More information

Servlet Basics. Agenda

Servlet Basics. Agenda Servlet Basics 1 Agenda The basic structure of servlets A simple servlet that generates plain text A servlet that generates HTML Servlets and packages Some utilities that help build HTML The servlet life

More information

Introduction. Literature: Steelman & Murach, Murach s Java Servlets and JSP. Mike Murach & Associates Inc, 2003

Introduction. Literature: Steelman & Murach, Murach s Java Servlets and JSP. Mike Murach & Associates Inc, 2003 Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations

More information

Introduction to Servlets. After which you will doget it

Introduction to Servlets. After which you will doget it Introduction to Servlets After which you will doget it Servlet technology A Java servlet is a Java program that extends the capabilities of a server. Although servlets can respond to any types of requests,

More information

Develop an Enterprise Java Bean for Banking Operations

Develop an Enterprise Java Bean for Banking Operations Develop an Enterprise Java Bean for Banking Operations Aim: Develop a Banking application using EJB3.0 Software and Resources: Software or Resource Version Required NetBeans IDE 6.7, Java version Java

More information

Supplement IV.E: Tutorial for Tomcat For Introduction to Java Programming By Y. Daniel Liang

Supplement IV.E: Tutorial for Tomcat For Introduction to Java Programming By Y. Daniel Liang Supplement IV.E: Tutorial for Tomcat 5.5.9 For Introduction to Java Programming By Y. Daniel Liang This supplement covers the following topics: Obtaining and Installing Tomcat Starting and Stopping Tomcat

More information

CS433 Technology Overview

CS433 Technology Overview CS433 Technology Overview Scott Selikoff Cornell University November 13, 2002 Outline I. Introduction II. Stored Procedures III. Java Beans IV. JSPs/Servlets V. JSPs vs. Servlets VI. XML Introduction VII.

More information

Getting started with Winstone. Minimal servlet container

Getting started with Winstone. Minimal servlet container Getting started with Winstone Minimal servlet container What is Winstone? Winstone is a small servlet container, consisting of a single JAR file. You can run Winstone on your computer using Java, and get

More information

( A ) 8. If the address of an array is stored in $value, how do you get the values of this array? (B) \$value (C) &$value (D) $$value

( A ) 8. If the address of an array is stored in $value, how do you get the values of this array? (B) \$value (C) &$value (D) $$value CS 665 Information Delivery on the Internet Final Exam - Name: Fall 2002 Part 1: (75 points - 3 points for each problem) ( A ) 1. What protocol is used by all Web communications transactions? (A) HTTP

More information

This tutorial will teach you how to use Java Servlets to develop your web based applications in simple and easy steps.

This tutorial will teach you how to use Java Servlets to develop your web based applications in simple and easy steps. About the Tutorial Servlets provide a component-based, platform-independent method for building Webbased applications, without the performance limitations of CGI programs. Servlets have access to the entire

More information

INTERNET PROGRAMMING TEST-3 SCHEME OF EVALUATION 1.A 3 LIFE CYCLE METHODS - 3M 1.B HTML FORM CREATION - 2 M

INTERNET PROGRAMMING TEST-3 SCHEME OF EVALUATION 1.A 3 LIFE CYCLE METHODS - 3M 1.B HTML FORM CREATION - 2 M INTERNET PROGRAMMING TEST-3 SCHEME OF EVALUATION 1.A 3 LIFE CYCLE METHODS - 3M EXPLANATION - 1.B HTML FORM CREATION - 2 M SERVLET CODE IN POST METHOD IMPORT STATEMENTS - CLASS NAME AND METHOD (POST) -

More information

Session 9. Introduction to Servlets. Lecture Objectives

Session 9. Introduction to Servlets. Lecture Objectives Session 9 Introduction to Servlets Lecture Objectives Understand the foundations for client/server Web interactions Understand the servlet life cycle 2 10/11/2018 1 Reading & Reference Reading Use the

More information

CREATE A SERVLET PROGRAM TO DISPLAY THE STUDENTS MARKS. To create a servlet program to display the students marks

CREATE A SERVLET PROGRAM TO DISPLAY THE STUDENTS MARKS. To create a servlet program to display the students marks CREATE A SERVLET PROGRAM TO DISPLAY THE STUDENTS MARKS DATE: 30.9.11 Aim: To create a servlet program to display the students marks Hardware requirements: Intel Core 2 Quad 2GB RAM Software requirements:

More information

Structure Bars. Tag Bar

Structure Bars. Tag Bar C H E A T S H E E T / / F L A R E 2 0 1 8 Structure Bars The XML Editor provides structure bars above and to the left of the content area in order to provide a visual display of the topic tags and structure.

More information

Java Servlets. Preparing your System

Java Servlets. Preparing your System Java Servlets Preparing to develop servlets Writing and running an Hello World servlet Servlet Life Cycle Methods The Servlet API Loading and Testing Servlets Preparing your System Locate the file jakarta-tomcat-3.3a.zip

More information

Servlets. An extension of a web server runs inside a servlet container

Servlets. An extension of a web server runs inside a servlet container Servlets What is a servlet? An extension of a web server runs inside a servlet container A Java class derived from the HttpServlet class A controller in webapplications captures requests can forward requests

More information

&' () - #-& -#-!& 2 - % (3" 3 !!! + #%!%,)& ! "# * +,

&' () - #-& -#-!& 2 - % (3 3 !!! + #%!%,)& ! # * +, ! "# # $! " &' ()!"#$$&$'(!!! ($) * + #!,)& - #-& +"- #!(-& #& #$.//0& -#-!& #-$$!& 1+#& 2-2" (3" 3 * * +, - -! #.// HttpServlet $ Servlet 2 $"!4)$5 #& 5 5 6! 0 -.// # 1 7 8 5 9 2 35-4 2 3+ -4 2 36-4 $

More information

JavaServer Pages (JSP)

JavaServer Pages (JSP) JavaServer Pages (JSP) The Context The Presentation Layer of a Web App the graphical (web) user interface frequent design changes usually, dynamically generated HTML pages Should we use servlets? No difficult

More information

OpenClinica: Towards Database Abstraction, Part 1

OpenClinica: Towards Database Abstraction, Part 1 OpenClinica: Towards Database Abstraction, Part 1 Author: Tom Hickerson, Akaza Research Date Created: 8/26/2004 4:17 PM Date Updated: 6/10/2005 3:22 PM, Document Version: v0.3 Document Summary This document

More information

Stateless -Session Bean

Stateless -Session Bean Stateless -Session Bean Prepared by: A.Saleem Raja MCA.,M.Phil.,(M.Tech) Lecturer/MCA Chettinad College of Engineering and Technology-Karur E-Mail: asaleemrajasec@gmail.com Creating an Enterprise Application

More information

To follow the Deitel publishing program, sign-up now for the DEITEL BUZZ ON-

To follow the Deitel publishing program, sign-up now for the DEITEL BUZZ ON- Ordering Information: Advanced Java 2 Platform How to Program View the complete Table of Contents Read the Preface Download the Code Examples To view all the Deitel products and services available, visit

More information

CS506 Web Design & Development Final Term Solved MCQs with Reference

CS506 Web Design & Development Final Term Solved MCQs with Reference with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar

More information

Using Java servlets to generate dynamic WAP content

Using Java servlets to generate dynamic WAP content C H A P T E R 2 4 Using Java servlets to generate dynamic WAP content 24.1 Generating dynamic WAP content 380 24.2 The role of the servlet 381 24.3 Generating output to WAP clients 382 24.4 Invoking a

More information

Session 10. Form Dataset. Lecture Objectives

Session 10. Form Dataset. Lecture Objectives Session 10 Form Dataset Lecture Objectives Understand the relationship between HTML form elements and parameters that are passed to the servlet, particularly the form dataset 2 10/1/2018 1 Example Form

More information

Servlet 5.1 JDBC 5.2 JDBC

Servlet 5.1 JDBC 5.2 JDBC 5 Servlet Java 5.1 JDBC JDBC Java DataBase Connectivity Java API JDBC Java Oracle, PostgreSQL, MySQL Java JDBC Servlet OpenOffice.org ver. 2.0 HSQLDB HSQLDB 100% Java HSQLDB SQL 5.2 JDBC Java 1. JDBC 2.

More information

Summary 4/5. (contains info about the html)

Summary 4/5. (contains info about the html) Summary Tag Info Version Attributes Comment 4/5

More information

Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실

Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실 데이타베이스시스템연구실 Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실 Overview http://www.tutorialspoint.com/jsp/index.htm What is JavaServer Pages? JavaServer Pages (JSP) is a server-side programming

More information

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1 Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1 Introducing Object Oriented Programming... 2 Explaining OOP concepts... 2 Objects...3

More information

LAB 1 PREPARED BY : DR. AJUNE WANIS ISMAIL FACULTY OF COMPUTING UNIVERSITI TEKNOLOGI MALAYSIA

LAB 1 PREPARED BY : DR. AJUNE WANIS ISMAIL FACULTY OF COMPUTING UNIVERSITI TEKNOLOGI MALAYSIA LAB 1 PREPARED BY : DR. AJUNE WANIS ISMAIL FACULTY OF COMPUTING UNIVERSITI TEKNOLOGI MALAYSIA Setting up Java Development Kit This step involves downloading an implementation of the Java Software Development

More information

CSC309: Introduction to Web Programming. Lecture 10

CSC309: Introduction to Web Programming. Lecture 10 CSC309: Introduction to Web Programming Lecture 10 Wael Aboulsaadat WebServer - WebApp Communication 2. Servlets Web Browser Get servlet/serv1? key1=val1&key2=val2 Web Server Servlet Engine WebApp1 serv1

More information

Backend. (Very) Simple server examples

Backend. (Very) Simple server examples Backend (Very) Simple server examples Web server example Browser HTML form HTTP/GET Webserver / Servlet JDBC DB Student example sqlite>.schema CREATE TABLE students(id integer primary key asc,name varchar(30));

More information

Servlet. Web Server. Servlets are modules of Java code that run in web server. Internet Explorer. Servlet. Fire Fox. Servlet.

Servlet. Web Server. Servlets are modules of Java code that run in web server. Internet Explorer. Servlet. Fire Fox. Servlet. Servlet OOS Lab Servlet OOS Servlets are modules of Java code that run in web server. Internet Explorer Web Server Fire Fox Servlet Servlet Servlet Java Application 2 Servlet - Example OOS import java.io.*;

More information

Servlet for Json or CSV (or XML) A servlet serving either Json or CSV (or XML) based on GET parameter - This version uses org.json

Servlet for Json or CSV (or XML) A servlet serving either Json or CSV (or XML) based on GET parameter - This version uses org.json Servlet for Json or CSV (or XML) A servlet serving either Json or CSV (or XML) based on GET parameter - This version uses org.json A Servlet used as an API for data Let s say we want to write a Servlet

More information

A.1 JSP A.2 JSP JSP JSP. MyDate.jsp page contenttype="text/html; charset=windows-31j" import="java.util.calendar" %>

A.1 JSP A.2 JSP JSP JSP. MyDate.jsp page contenttype=text/html; charset=windows-31j import=java.util.calendar %> A JSP A.1 JSP Servlet Java HTML JSP HTML Java ( HTML JSP ) JSP Servlet Servlet HTML JSP MyDate.jsp

More information

Chettinad College of Engineering and Technology CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND TECHNOLOGY

Chettinad College of Engineering and Technology CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND TECHNOLOGY CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND TECHNOLOGY UNIT IV SERVLETS 1. What is Servlets? a. Servlets are server side components that provide a powerful mechanism

More information

Université Antonine - Baabda

Université Antonine - Baabda Université Antonine - Baabda Faculté d ingénieurs en Informatique, Multimédia, Systèmes, Réseaux et Télécommunications Applications mobiles (Pocket PC, etc ) Project: Manipulate School Database Préparé

More information

An implementation of Tree Panel component in EXT JS 4.0

An implementation of Tree Panel component in EXT JS 4.0 An implementation of Tree Panel component in EXT JS 4.0 By Hamid M. Porasl This implementation contains an HTML file that t is used to invoke used EXT JS java script files and our implemented java Script

More information

SWE642 Oct. 22, 2003

SWE642 Oct. 22, 2003 import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.arraylist; DataServlet.java /** * First servlet in a two servlet application. It is responsible

More information

Handout 31 Web Design & Development

Handout 31 Web Design & Development Lecture 31 Session Tracking We have discussed the importance of session tracking in the previous handout. Now, we ll discover the basic techniques used for session tracking. Cookies are one of these techniques

More information

Module 4: SERVLET and JSP

Module 4: SERVLET and JSP 1.What Is a Servlet? Module 4: SERVLET and JSP A servlet is a small Java program that runs within a Web server. Servlets receive and respond to requests from Web clients, usually across HTTP, the Hyper

More information

Servlet. 1.1 Web. 1.2 Servlet. HTML CGI Common Gateway Interface Web CGI CGI. Java Applet JavaScript Web. Java CGI Servlet. Java. Apache Tomcat Jetty

Servlet. 1.1 Web. 1.2 Servlet. HTML CGI Common Gateway Interface Web CGI CGI. Java Applet JavaScript Web. Java CGI Servlet. Java. Apache Tomcat Jetty 1 Servlet 1.1 Web Web WWW HTML CGI Common Gateway Interface Web HTML Web Web CGI CGI CGI Perl, PHP C Java Applet JavaScript Web CGI HTML 1.2 Servlet Java Servlet Servlet CGI Web CGI 1 Java Java JVM Java

More information

Université du Québec à Montréal

Université du Québec à Montréal Laboratoire de Recherches sur les Technologies du Commerce Électronique Université du Québec à Montréal Rapport de recherche Latece 2017-3 Identifying KDM Model of JSP Pages Anas Shatnawi, Hafedh Mili,

More information

Using the JBoss IDE for Eclipse

Using the JBoss IDE for Eclipse Using the JBoss IDE for Eclipse Important: Some combinations of JBoss/JBoss-IDE/Eclipse do not like to work with each other. Be very careful about making sure all the software versions are compatible.

More information

A Servlet-Based Search Engine. Introduction

A Servlet-Based Search Engine. Introduction A Servlet-Based Search Engine Introduction Architecture Implementation Summary Introduction Pros Suitable to be deployed as a search engine for a static web site Very efficient in dealing with client requests

More information

Advanced Internet Technology Lab # 5 Handling Client Requests

Advanced Internet Technology Lab # 5 Handling Client Requests Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Advanced Internet Technology Lab # 5 Handling Client Requests Eng. Doaa Abu Jabal Advanced Internet Technology Lab

More information

Welcome To PhillyJUG. 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation

Welcome To PhillyJUG. 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation Welcome To PhillyJUG 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation Web Development With The Struts API Tom Janofsky Outline Background

More information

Lab session Google Application Engine - GAE. Navid Nikaein

Lab session Google Application Engine - GAE. Navid Nikaein Lab session Google Application Engine - GAE Navid Nikaein Available projects Project Company contact Mobile Financial Services Innovation TIC Vasco Mendès Bluetooth low energy Application on Smart Phone

More information

Unit 4 - Servlet. Servlet. Advantage of Servlet

Unit 4 - Servlet. Servlet. Advantage of Servlet Servlet Servlet technology is used to create web application, resides at server side and generates dynamic web page. Before Servlet, CGI (Common Gateway Interface) was popular as a server-side programming

More information

Enterprise Java Technologies (Part 1 of 3) Component Architecture. Overview of Java EE. Java Servlets

Enterprise Java Technologies (Part 1 of 3) Component Architecture. Overview of Java EE. Java Servlets ID2212 Network Programming with Java Lecture 10 Enterprise Java Technologies (Part 1 of 3) Component Architecture. Overview of Java EE. Java Servlets Leif Lindbäck, Vladimir Vlassov KTH/ICT/SCS HT 2015

More information

Advanced Topics in Operating Systems. Manual for Lab Practices. Enterprise JavaBeans

Advanced Topics in Operating Systems. Manual for Lab Practices. Enterprise JavaBeans University of New York, Tirana M.Sc. Computer Science Advanced Topics in Operating Systems Manual for Lab Practices Enterprise JavaBeans PART III A Web Banking Application with EJB and MySQL Development

More information

Unit-4: Servlet Sessions:

Unit-4: Servlet Sessions: 4.1 What Is Session Tracking? Unit-4: Servlet Sessions: Session tracking is the capability of a server to maintain the current state of a single client s sequential requests. Session simply means a particular

More information

Introduction. This course Software Architecture with Java will discuss the following topics:

Introduction. This course Software Architecture with Java will discuss the following topics: Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations

More information

The Servlet Life Cycle

The Servlet Life Cycle The Servlet Life Cycle What is a servlet? Servlet is a server side component which receives a request from a client, processes the request and sends a content based response back to the client. The Servlet

More information

Advanced Web Technology

Advanced Web Technology Berne University of Applied Sciences Dr. E. Benoist Winter Term 2005-2006 Presentation 1 Presentation of the Course Part Java and the Web Servlet JSP and JSP Deployment The Model View Controler (Java Server

More information

WHITE LABELING IN PROGRESS ROLLBASE PRIVATE CLOUD

WHITE LABELING IN PROGRESS ROLLBASE PRIVATE CLOUD W HI TEPAPER www. p rogres s.com WHITE LABELING IN PROGRESS ROLLBASE PRIVATE CLOUD In this whitepaper, we describe how to white label Progress Rollbase private cloud with your brand name by following a

More information

Copyright 2005, by Object Computing, Inc. (OCI). All rights reserved. Database to Web

Copyright 2005, by Object Computing, Inc. (OCI). All rights reserved. Database to Web Database To Web 10-1 The Problem Need to present information in a database on web pages want access from any browser may require at least HTML 4 compatibility Want to separate gathering of data from formatting

More information

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space. HTML Summary Structure All of the following are containers. Structure Contains the entire web page. Contains information

More information

Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 2

Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 2 Java Servlets Adv. Web Technologies 1) Servlets (introduction) Emmanuel Benoist Fall Term 2016-17 Introduction HttpServlets Class HttpServletResponse HttpServletRequest Lifecycle Methods Session Handling

More information

UNIT-V. Web Servers: Tomcat Server Installation:

UNIT-V. Web Servers: Tomcat Server Installation: UNIT-V Web Servers: The Web server is meant for keeping Websites. It Stores and transmits web documents (files). It uses the HTTP protocol to connect to other computers and distribute information. Example:

More information

Accessing EJB in Web applications

Accessing EJB in Web applications Accessing EJB in Web applications 1. 2. 3. 4. Developing Web applications Accessing JDBC in Web applications To run this tutorial, as a minimum you will be required to have installed the following prerequisite

More information

SSC - Web applications and development Introduction and Java Servlet (I)

SSC - Web applications and development Introduction and Java Servlet (I) SSC - Web applications and development Introduction and Java Servlet (I) Shan He School for Computational Science University of Birmingham Module 06-19321: SSC Outline Outline of Topics What will we learn

More information

a. Jdbc:ids://localhost:12/conn?dsn=dbsysdsn 21. What is the Type IV Driver URL? a. 22.

a. Jdbc:ids://localhost:12/conn?dsn=dbsysdsn 21. What is the Type IV Driver URL? a. 22. Answers 1. What is the super interface to all the JDBC Drivers, specify their fully qualified name? a. Java.sql.Driver i. JDBC-ODBC Driver ii. Java-Native API Driver iii. All Java Net Driver iv. Java Native

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Java Server Pages (JSP) Dr. Basem Suleiman Service Oriented Computing Group, CSE, UNSW Australia Semester 1, 2016, Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2442

More information

Servlet and JSP Review

Servlet and JSP Review 2006 Marty Hall Servlet and JSP Review A Recap of the Basics 2 JSP, Servlet, Struts, JSF, AJAX, & Java 5 Training: http://courses.coreservlets.com J2EE Books from Sun Press: http://www.coreservlets.com

More information

Enterprise Java Unit 1- Chapter 4 Prof. Sujata Rizal Servlet API and Lifecycle

Enterprise Java Unit 1- Chapter 4 Prof. Sujata Rizal Servlet API and Lifecycle Introduction Now that the concept of servlet is in place, let s move one step further and understand the basic classes and interfaces that java provides to deal with servlets. Java provides a servlet Application

More information

Scheme G Sample Question Paper Unit Test 2

Scheme G Sample Question Paper Unit Test 2 Scheme G Sample Question Paper Unit Test 2 Course Name: Computer Engineering Group Course Code: CO/CD/CM/CW/IF Semester: Sixth Subject Title: Advanced Java Programming Marks: 25 Marks 17625 ---------------------------------------------------------------------------------------------------------------------------

More information

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM Advanced Internet Technology Lab.

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM Advanced Internet Technology Lab. Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 5049 Advanced Internet Technology Lab Lab # 1 Eng. Haneen El-masry February, 2015 Objective To be familiar with

More information

SERVLET AND JSP FILTERS

SERVLET AND JSP FILTERS SERVLET AND JSP FILTERS FILTERS OVERVIEW Filter basics Accessing the servlet context Using initialization parameters Blocking responses Modifying responses FILTERS: OVERVIEW Associated with any number

More information

Demonstration of Servlet, JSP with Tomcat, JavaDB in NetBeans

Demonstration of Servlet, JSP with Tomcat, JavaDB in NetBeans Demonstration of Servlet, JSP with Tomcat, JavaDB in NetBeans Installation pre-requisites: NetBeans 7.01 or above is installed; Tomcat 7.0.14.0 or above is installed properly with NetBeans; (see step 7

More information

To create a view for students, staffs and courses in your departments using servlet/jsp.

To create a view for students, staffs and courses in your departments using servlet/jsp. Aim To create a view for students, staffs and courses in your departments using servlet/jsp. Software Requirements: Java IDE Database Server JDK1.6 Netbean 6.9/Eclipse MySQL Tomcat/Glassfish Login Form

More information

Servlets and JSP (Java Server Pages)

Servlets and JSP (Java Server Pages) Servlets and JSP (Java Server Pages) XML HTTP CGI Web usability Last Week Nan Niu (nn@cs.toronto.edu) CSC309 -- Fall 2008 2 Servlets Generic Java2EE API for invoking and connecting to mini-servers (lightweight,

More information

Introduction to Java Servlets. SWE 432 Design and Implementation of Software for the Web

Introduction to Java Servlets. SWE 432 Design and Implementation of Software for the Web Introduction to Java Servlets James Baldo Jr. SWE 432 Design and Implementation of Software for the Web Web Applications A web application uses enabling technologies to 1. make web site contents dynamic

More information

Chapter 2 How to structure a web application with the MVC pattern

Chapter 2 How to structure a web application with the MVC pattern Chapter 2 How to structure a web application with the MVC pattern Murach's Java Servlets/JSP (3rd Ed.), C2 2014, Mike Murach & Associates, Inc. Slide 1 Objectives Knowledge 1. Describe the Model 1 pattern.

More information

Html basics Course Outline

Html basics Course Outline Html basics Course Outline Description Learn the essential skills you will need to create your web pages with HTML. Topics include: adding text any hyperlinks, images and backgrounds, lists, tables, and

More information

HttpServlet ( Class ) -- we will extend this class to handle GET / PUT HTTP requests

HttpServlet ( Class ) -- we will extend this class to handle GET / PUT HTTP requests What is the servlet? Servlet is a script, which resides and executes on server side, to create dynamic HTML. In servlet programming we will use java language. A servlet can handle multiple requests concurrently.

More information

Directory structure and development environment set up

Directory structure and development environment set up Directory structure and development environment set up 1. Install ANT: Download & unzip (or untar) the ant zip file - jakarta-ant-1.5.1-bin.zip to a directory say ANT_HOME (any directory is fine) Add the

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2411 1 Review:

More information

An Introduction to WebSphere Portal content publishing channels

An Introduction to WebSphere Portal content publishing channels An Introduction to WebSphere Portal content publishing channels By Gregory Melahn Software Engineer, IBM Corp. May 2003 Abstract WebSphere Portal content publishing (WPCP) allows you to import news stories

More information

JAVA SERVLET. Server-side Programming ADVANCED FEATURES

JAVA SERVLET. Server-side Programming ADVANCED FEATURES JAVA SERVLET Server-side Programming ADVANCED FEATURES 1 AGENDA RequestDispacher SendRedirect ServletConfig ServletContext ServletFilter SingleThreadedModel Events and Listeners Servlets & Database 2 REQUESTDISPATCHER

More information