<%--
This page won't actually work, as it is simply designed to display jsp syntax highlighting.
--%>
<%@ 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"%>
id="aPageBean" scope="page" class="my.package.MyPageBean"/>
id="aRequestBean" scope="request" class="my.package.MyRequestBean"/>
<%
// 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);


%>

A Sample Jsp





<%-- The top label table. --%>
width="400" cellpadding="0" cellspacing="0" border="0">

size="3">The following parameters were detected:



<%-- Display the parameters which might have been passed in. --%>
width="400" cellpadding="0" cellspacing="0" border="0">
<%-- Label; Actual Parameter String; Value Detected --%>

PARAMETER_1
align="center"><%=PARAMETER_1%>
align="right">"<%=parm1%>"


<%-- Label; Actual Parameter String; Value Detected --%>

PARAMETER_2
align="center"><%=PARAMETER_2%>
align="right">"<%=parm2%>"


<%-- Label; Actual Parameter String; Value Detected --%>

PARAMETER_3
align="center"><%=PARAMETER_3%>
align="right">"<%=parm3%>"


<%-- Label; Actual Parameter String; Value Detected --%>

PARAMETER_4
align="center"><%=PARAMETER_4%>
align="right">"<%=parm4%>"


<%-- Label; Actual Parameter String; Value Detected --%>

PARAMETER_5
align="center"><%=PARAMETER_5%>
align="right">"<%=parm5%>"







<%-- Display our list of random Integers (shows code folding). --%>
width="400" cellpadding="0" cellspacing="0" border="0">
<%
if (intList != null && intList.size() > 0) {
%>
Here are the elements of intList...
<%
Iterator intListIt = intList.iterator();
while (intListIt.hasNext()) {
Integer i = (Integer) intListIt.next();
%>
<%=i.toString()%>
<%
}
} else {
%>
color="blue">Oooops, we forgot to initialize intList!
<%
}
%>






<%-- We can call javascript functions. --%>
width="400" cellpadding="0" cellspacing="0" border="0">
colspan="2">Test our javascript...

type="button" name="button1" value="Alert 1" onmouseup="javascript:doAlert1()">
type="button" name="button2" value="Alert 2" onmouseup="javascript:doAlert2()">






<%-- If we actually had defined a tag library. --%>
width="400" cellpadding="0" cellspacing="0" border="0">

prop1="first" prop2="third">
nameProp="value1"/>
nameProp="value2"/>







<%-- Expression language. --%>
width="400" cellpadding="0" cellspacing="0" border="0">
test="${!empty param.aParam}">
var="myParam" scope="session" value="${param.aParam}"/>


myParam's value: " value="${myParam}" default=="Default"/>"



<%!
/* A place for class variables and functions... */

// 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) {
String retStr;
if (str == null)
retStr = "";
else
retStr = str.trim();

return retStr;
}

// Returns a list of Integers with listSize elements.
private static List getIntList(int listSize) {
ArrayList retList = new ArrayList(listSize);
for (int i = 0; i < listSize; i++)
retList.add(new Integer( (int) (Math.random() * 100) ));

return retList;
}
%>