make designMode property available from js
[kdelibs.git] / kate / tests / highlight.jsp
blobd912836bd8585114a1a059f686d8c0565ac11ce7
1 <%--
2 This page won't actually work, as it is simply designed to display jsp syntax highlighting.
3 --%>
4 <%@ page info="A Page to Test Kate Jsp Syntax Highlighting" language="java" errorPage="/test-error-page.jsp"%>
5 <%@ include file="/include/myglobalvars.jsp"%> --%>
6 <%@ page import="java.util.*,
7 java.io.*,
8 java.math.*" %>
9 <%@ taglib uri="/WEB-INF/lib/si_taglib.tld" prefix="si"%>
10 <jsp:useBean id="aPageBean" scope="page" class="my.package.MyPageBean"/>
11 <jsp:useBean id="aRequestBean" scope="request" class="my.package.MyRequestBean"/>
13 // We can decipher our expected parameters here.
14 String parm1 = noNull(request.getParameter(PARAMETER_1)).trim();
15 String parm2 = noNull(request.getParameter(PARAMETER_2)).trim();
16 String parm3 = noNull(request.getParameter(PARAMETER_3)).trim();
17 String parm4 = noNull(request.getParameter(PARAMETER_4)).trim();
18 String parm5 = noNull(request.getParameter(PARAMETER_5)).trim();
20 // A sample collection of Integers to display some code folding.
21 List intList = getIntList(10);
25 <html>
26 <title>A Sample Jsp</title>
27 <head>
28 <script language="javascript"><!--
29 function doAlert1() {
30 alert("This is the first javascript example.");
33 function doAlert2() {
34 alert("This is the second javascript example.");
36 //--></script>
37 </head>
38 <body>
39 <%-- The top label table. --%>
40 <table width="400" cellpadding="0" cellspacing="0" border="0">
41 <tr>
42 <td><font size="3"><b>The following parameters were detected:</b></font></td>
43 </tr>
44 </table>
46 <%-- Display the parameters which might have been passed in. --%>
47 <table width="400" cellpadding="0" cellspacing="0" border="0">
48 <%-- Label; Actual Parameter String; Value Detected --%>
49 <tr>
50 <td><b>PARAMETER_1</b></td>
51 <td align="center"><%=PARAMETER_1%></td>
52 <td align="right">&quot;<%=parm1%>&quot;</td>
53 </tr>
55 <%-- Label; Actual Parameter String; Value Detected --%>
56 <tr>
57 <td><b>PARAMETER_2</b></td>
58 <td align="center"><%=PARAMETER_2%></td>
59 <td align="right">&quot;<%=parm2%>&quot;</td>
60 </tr>
62 <%-- Label; Actual Parameter String; Value Detected --%>
63 <tr>
64 <td><b>PARAMETER_3</b></td>
65 <td align="center"><%=PARAMETER_3%></td>
66 <td align="right">&quot;<%=parm3%>&quot;</td>
67 </tr>
69 <%-- Label; Actual Parameter String; Value Detected --%>
70 <tr>
71 <td><b>PARAMETER_4</b></td>
72 <td align="center"><%=PARAMETER_4%></td>
73 <td align="right">&quot;<%=parm4%>&quot;</td>
74 </tr>
76 <%-- Label; Actual Parameter String; Value Detected --%>
77 <tr>
78 <td><b>PARAMETER_5</b></td>
79 <td align="center"><%=PARAMETER_5%></td>
80 <td align="right">&quot;<%=parm5%>&quot;</td>
81 </tr>
82 </table>
84 <br><br>
86 <%-- Display our list of random Integers (shows code folding). --%>
87 <table width="400" cellpadding="0" cellspacing="0" border="0">
89 if (intList != null && intList.size() > 0) {
91 <tr><td><b>Here are the elements of intList...</b></td></tr>
93 Iterator intListIt = intList.iterator();
94 while (intListIt.hasNext()) {
95 Integer i = (Integer) intListIt.next();
97 <tr><td><%=i.toString()%></td></tr>
100 } else {
102 <tr><td><font color="blue"><b><i>Oooops, we forgot to initialize intList!</i></b></font></td></tr>
106 </table>
108 <br><br>
110 <%-- We can call javascript functions. --%>
111 <table width="400" cellpadding="0" cellspacing="0" border="0">
112 <tr><td colspan="2"><b>Test our javascript...</b></td></tr>
113 <tr>
114 <td><input type="button" name="button1" value="Alert 1" onmouseup="javascript:doAlert1()"></td>
115 <td><input type="button" name="button2" value="Alert 2" onmouseup="javascript:doAlert2()"></td>
116 </tr>
117 </table>
119 <br><br>
120 <%-- If we actually had defined a tag library. --%>
121 <table width="400" cellpadding="0" cellspacing="0" border="0">
122 <tr><td>
123 <my:SampleTag prop1="first" prop2="third">
124 <my:SampleTagChild nameProp="value1"/>
125 <my:SampleTagChild nameProp="value2"/>
126 </my:SampleTag>
127 </td></tr>
128 </table>
130 <br><br>
131 <%-- Expression language. --%>
132 <table width="400" cellpadding="0" cellspacing="0" border="0">
133 <c:if test="${!empty param.aParam}">
134 <c:set var="myParam" scope="session" value="${param.aParam}"/>
135 </c:if>
137 <tr><td>myParam's value: &quot;<c:out value="${myParam}" default=="Default"/>&quot;</td></tr>
138 </table>
139 </body>
140 </html>
142 /* A place for class variables and functions... */
144 // Define some sample parameter names that this page might understand.
145 private static final String PARAMETER_1 = "p1";
146 private static final String PARAMETER_2 = "p2";
147 private static final String PARAMETER_3 = "p3";
148 private static final String PARAMETER_4 = "p4";
149 private static final String PARAMETER_5 = "p5";
151 // Returns str trimmed, or an empty string if str is null.
152 private static String noNull(String str) {
153 String retStr;
154 if (str == null)
155 retStr = "";
156 else
157 retStr = str.trim();
159 return retStr;
162 // Returns a list of Integers with listSize elements.
163 private static List getIntList(int listSize) {
164 ArrayList retList = new ArrayList(listSize);
165 for (int i = 0; i < listSize; i++)
166 retList.add(new Integer( (int) (Math.random() * 100) ));
168 return retList;