Articles/JSPIntegration: index.jsp

File index.jsp, 2.2 kB (added by Teemu Pontelin, 7 months ago)
Line 
1<%@ page language="java" contentType="text/html; charset=UTF-8"
2    pageEncoding="UTF-8"%>
3   
4       
5<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
6        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
7   
8<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
9    <head>
10        <title>JSP - IT Mill Toolkit 5 - integration example</title>
11        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
12               
13                <%
14               
15                // URI of the Toolkit application (defined in web.xml)
16                String appUri = "TableApplication";
17               
18                // id of the div element to embed the Toolkit application into         
19                String appDiv = "itmApplication";
20               
21                // context path of the application
22                String contextPath = "/JspToolkitIntegration";
23               
24                %>               
25                <jsp:include page="toolkitIntegration.jsp">
26                        <jsp:param name="appUri" value="<%=appUri %>"/>
27                        <jsp:param name="appDiv" value="<%=appDiv %>"/>
28                        <jsp:param name="contextPath" value="<%=contextPath %>"/>                       
29                </jsp:include>
30       
31        <script type="text/javascript">
32        // <![CDATA
33                               
34                /**
35                 * Submits the value of input#filterString element to the server
36                 * and puts the returned result count into p#resultsFound element.
37                 */
38                        function submitData() {                                                                 
39                                var filterString = document.getElementById("filterString");
40                                if (filterString) {                             
41                                        itmSubmitData("refresh/" + filterString.value, function(response) {
42                                                        document.getElementById("resultsFound").innerHTML = "Results found " + response;
43                                                        itmill.forceSync();
44                                        });
45                                }                       
46                                return false;                                                                           
47                        }                                                       
48                       
49                // ]]>
50                </script>
51        </head>
52       
53        <body class="i-generated-body">                         
54                <p>This is a JSP page with an embeded IT Mill Toolkit 5 application</p>
55               
56                <form action="post" onsubmit="return submitData()">             
57                        <label for="filterString">Filter by first name</label>
58                        <input type="text" name="filterString" id="filterString" />
59                        <input type="submit" value="Filter" />                 
60                </form>
61                <p id="resultsFound"></p>
62               
63                <div id="<%=appDiv %>" style="height: 500px; margin: 10px"></div>
64        </body>
65</html>