174 lines
8.2 KiB
Plaintext
174 lines
8.2 KiB
Plaintext
<beginfold id='1'><%--</beginfold id='1'>
|
|
This page won't actually work, as it is simply designed to display jsp syntax highlighting.
|
|
<endfold id='1'>--%></endfold id='1'>
|
|
<%@ page info="A Page to Test Kate Jsp Syntax Highlighting" language="java" errorPage="/test-error-page.jsp"%>
|
|
<%@ include file="/include/myglobalvars.jsp"%> --%>
|
|
<%@ page import="java.util.*,
|
|
java.io.*,
|
|
java.math.*" %>
|
|
<%@ taglib uri="/WEB-INF/lib/si_taglib.tld" prefix="si"%>
|
|
<jsp:useBean id="aPageBean" scope="page" class="my.package.MyPageBean"/>
|
|
<jsp:useBean id="aRequestBean" scope="request" class="my.package.MyRequestBean"/>
|
|
<beginfold id='2'><%</beginfold id='2'>
|
|
// We can decipher our expected parameters here.
|
|
String parm1 = noNull(request.getParameter(PARAMETER_1)).trim();
|
|
String parm2 = noNull(request.getParameter(PARAMETER_2)).trim();
|
|
String parm3 = noNull(request.getParameter(PARAMETER_3)).trim();
|
|
String parm4 = noNull(request.getParameter(PARAMETER_4)).trim();
|
|
String parm5 = noNull(request.getParameter(PARAMETER_5)).trim();
|
|
|
|
// A sample collection of Integers to display some code folding.
|
|
List intList = getIntList(10);
|
|
|
|
|
|
<endfold id='2'>%></endfold id='2'>
|
|
<html>
|
|
<title>A Sample Jsp</title>
|
|
<head>
|
|
<beginfold id='3'><script</beginfold id='3'> language="javascript"><!--
|
|
function doAlert1() <beginfold id='4'>{</beginfold id='4'>
|
|
alert("This is the first javascript example.");
|
|
<endfold id='4'>}</endfold id='4'>
|
|
|
|
function doAlert2() <beginfold id='4'>{</beginfold id='4'>
|
|
alert("This is the second javascript example.");
|
|
<endfold id='4'>}</endfold id='4'>
|
|
//--><endfold id='3'></script</endfold id='3'>>
|
|
<beginfold id='5'><style</beginfold id='5'> type="text/css">
|
|
body<beginfold id='6'>{</beginfold id='6'> color: yellow; <endfold id='6'>}</endfold id='6'>
|
|
<endfold id='5'></style></endfold id='5'>
|
|
</head>
|
|
<body>
|
|
<beginfold id='1'><%--</beginfold id='1'> The top label table. <endfold id='1'>--%></endfold id='1'>
|
|
<table width="400" cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td><font size="3"><b>The following parameters were detected:</b></font></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<beginfold id='1'><%--</beginfold id='1'> Display the parameters which might have been passed in. <endfold id='1'>--%></endfold id='1'>
|
|
<table width="400" cellpadding="0" cellspacing="0" border="0">
|
|
<beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'>
|
|
<tr>
|
|
<td><b>PARAMETER_1</b></td>
|
|
<td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_1<endfold id='2'>%></endfold id='2'></td>
|
|
<td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm1<endfold id='2'>%></endfold id='2'>"</td>
|
|
</tr>
|
|
|
|
<beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'>
|
|
<tr>
|
|
<td><b>PARAMETER_2</b></td>
|
|
<td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_2<endfold id='2'>%></endfold id='2'></td>
|
|
<td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm2<endfold id='2'>%></endfold id='2'>"</td>
|
|
</tr>
|
|
|
|
<beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'>
|
|
<tr>
|
|
<td><b>PARAMETER_3</b></td>
|
|
<td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_3<endfold id='2'>%></endfold id='2'></td>
|
|
<td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm3<endfold id='2'>%></endfold id='2'>"</td>
|
|
</tr>
|
|
|
|
<beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'>
|
|
<tr>
|
|
<td><b>PARAMETER_4</b></td>
|
|
<td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_4<endfold id='2'>%></endfold id='2'></td>
|
|
<td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm4<endfold id='2'>%></endfold id='2'>"</td>
|
|
</tr>
|
|
|
|
<beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'>
|
|
<tr>
|
|
<td><b>PARAMETER_5</b></td>
|
|
<td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_5<endfold id='2'>%></endfold id='2'></td>
|
|
<td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm5<endfold id='2'>%></endfold id='2'>"</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br><br>
|
|
|
|
<beginfold id='1'><%--</beginfold id='1'> Display our list of random Integers (shows code folding). <endfold id='1'>--%></endfold id='1'>
|
|
<table width="400" cellpadding="0" cellspacing="0" border="0">
|
|
<beginfold id='2'><%</beginfold id='2'>
|
|
if (intList != null && intList.size() > 0) <beginfold id='7'>{</beginfold id='7'>
|
|
<endfold id='2'>%></endfold id='2'>
|
|
<tr><td><b>Here are the elements of intList...</b></td></tr>
|
|
<beginfold id='2'><%</beginfold id='2'>
|
|
Iterator intListIt = intList.iterator();
|
|
while (intListIt.hasNext()) <beginfold id='7'>{</beginfold id='7'>
|
|
Integer i = (Integer) intListIt.next();
|
|
<endfold id='2'>%></endfold id='2'>
|
|
<tr><td><beginfold id='2'><%=</beginfold id='2'>i.toString()<endfold id='2'>%></endfold id='2'></td></tr>
|
|
<beginfold id='2'><%</beginfold id='2'>
|
|
<endfold id='7'>}</endfold id='7'>
|
|
<endfold id='7'>}</endfold id='7'> else <beginfold id='7'>{</beginfold id='7'>
|
|
<endfold id='2'>%></endfold id='2'>
|
|
<tr><td><font color="blue"><b><i>Oooops, we forgot to initialize intList!</i></b></font></td></tr>
|
|
<beginfold id='2'><%</beginfold id='2'>
|
|
<endfold id='7'>}</endfold id='7'>
|
|
<endfold id='2'>%></endfold id='2'>
|
|
</table>
|
|
|
|
<br><br>
|
|
|
|
<beginfold id='1'><%--</beginfold id='1'> We can call javascript functions. <endfold id='1'>--%></endfold id='1'>
|
|
<table width="400" cellpadding="0" cellspacing="0" border="0">
|
|
<tr><td colspan="2"><b>Test our javascript...</b></td></tr>
|
|
<tr>
|
|
<td><input type="button" name="button1" value="Alert 1" onmouseup="javascript:doAlert1()"></td>
|
|
<td><input type="button" name="button2" value="Alert 2" onmouseup="javascript:doAlert2()"></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br><br>
|
|
<beginfold id='1'><%--</beginfold id='1'> If we actually had defined a tag library. <endfold id='1'>--%></endfold id='1'>
|
|
<table width="400" cellpadding="0" cellspacing="0" border="0">
|
|
<tr><td>
|
|
<my:SampleTag prop1="first" prop2="third">
|
|
<my:SampleTagChild nameProp="value1"/>
|
|
<my:SampleTagChild nameProp="value2"/>
|
|
</my:SampleTag>
|
|
</td></tr>
|
|
</table>
|
|
|
|
<br><br>
|
|
<beginfold id='1'><%--</beginfold id='1'> Expression language. <endfold id='1'>--%></endfold id='1'>
|
|
<table width="400" cellpadding="0" cellspacing="0" border="0">
|
|
<c:if test="${!empty param.aParam}">
|
|
<c:set var="myParam" scope="session" value="${param.aParam}"/>
|
|
</c:if>
|
|
|
|
<tr><td>myParam's value: "<c:out value="${myParam}" default=="Default"/>"</td></tr>
|
|
</table>
|
|
</body>
|
|
</html>
|
|
<beginfold id='2'><%!</beginfold id='2'>
|
|
<beginfold id='8'>/*</beginfold id='8'> A place for class variables and functions... <endfold id='8'>*/</endfold id='8'>
|
|
|
|
// Define some sample parameter names that this page might understand.
|
|
private static final String PARAMETER_1 = "p1";
|
|
private static final String PARAMETER_2 = "p2";
|
|
private static final String PARAMETER_3 = "p3";
|
|
private static final String PARAMETER_4 = "p4";
|
|
private static final String PARAMETER_5 = "p5";
|
|
|
|
// Returns str trimmed, or an empty string if str is null.
|
|
private static String noNull(String str) <beginfold id='7'>{</beginfold id='7'>
|
|
String retStr;
|
|
if (str == null)
|
|
retStr = "";
|
|
else
|
|
retStr = str.trim();
|
|
|
|
return retStr;
|
|
<endfold id='7'>}</endfold id='7'>
|
|
|
|
// Returns a list of Integers with listSize elements.
|
|
private static List getIntList(int listSize) <beginfold id='7'>{</beginfold id='7'>
|
|
ArrayList retList = new ArrayList(listSize);
|
|
for (int i = 0; i < listSize; i++)
|
|
retList.add(new Integer( (int) (Math.random() * 100) ));
|
|
|
|
return retList;
|
|
<endfold id='7'>}</endfold id='7'>
|
|
<endfold id='2'>%></endfold id='2'>
|