~ubuntu-branches/ubuntu/vivid/kate/vivid-updates

« back to all changes in this revision

Viewing changes to examples/syntax/highlight.jsp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-12-04 16:49:41 UTC
  • mfrom: (1.6.6)
  • Revision ID: package-import@ubuntu.com-20141204164941-l3qbvsly83hhlw2v
Tags: 4:14.11.97-0ubuntu1
* New upstream release
* Update build-deps and use pkg-kde v3 for Qt 5 build
* kate-data now kate5-data for co-installability

Show diffs side-by-side

added added

removed removed

Lines of Context:
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"/>
12
 
<%
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();
19
 
 
20
 
  // A sample collection of Integers to display some code folding.
21
 
  List intList = getIntList(10);
22
 
 
23
 
 
24
 
%>
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.");
31
 
    }
32
 
 
33
 
    function doAlert2() {
34
 
      alert("This is the second javascript example.");
35
 
    }
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>
45
 
 
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>
54
 
 
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>
61
 
 
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>
68
 
 
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>
75
 
 
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>
83
 
 
84
 
    <br><br>
85
 
 
86
 
    <%-- Display our list of random Integers (shows code folding). --%>
87
 
    <table width="400" cellpadding="0" cellspacing="0" border="0">
88
 
<%
89
 
  if (intList != null && intList.size() > 0) {
90
 
%>
91
 
      <tr><td><b>Here are the elements of intList...</b></td></tr>
92
 
<%
93
 
    Iterator intListIt = intList.iterator();
94
 
    while (intListIt.hasNext()) {
95
 
      Integer i = (Integer) intListIt.next();
96
 
%>
97
 
      <tr><td><%=i.toString()%></td></tr>
98
 
<%
99
 
    }
100
 
  } else {
101
 
%>
102
 
      <tr><td><font color="blue"><b><i>Oooops, we forgot to initialize intList!</i></b></font></td></tr>
103
 
<%
104
 
  }
105
 
%>
106
 
    </table>
107
 
 
108
 
    <br><br>
109
 
 
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>
118
 
 
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>
129
 
 
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>
136
 
 
137
 
      <tr><td>myParam's value: &quot;<c:out value="${myParam}" default=="Default"/>&quot;</td></tr>
138
 
    </table>
139
 
  </body>
140
 
</html>
141
 
<%!
142
 
  /* A place for class variables and functions... */
143
 
 
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";
150
 
 
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();
158
 
 
159
 
    return retStr;
160
 
  }
161
 
 
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) ));
167
 
 
168
 
    return retList;
169
 
  }
170
 
%>
 
 
b'\\ No newline at end of file'