Warning, /frameworks/syntax-highlighting/autotests/input/highlight.jsp is written in an unsupported language. File is not indexed.
0001 <%-- 0002 This page won't actually work, as it is simply designed to display jsp syntax highlighting. 0003 --%> 0004 <%@ page info="A Page to Test Kate Jsp Syntax Highlighting" language="java" errorPage="/test-error-page.jsp"%> 0005 <%@ include file="/include/myglobalvars.jsp"%> --%> 0006 <%@ page import="java.util.*, 0007 java.io.*, 0008 java.math.*" %> 0009 <%@ taglib uri="/WEB-INF/lib/si_taglib.tld" prefix="si"%> 0010 <jsp:useBean id="aPageBean" scope="page" class="my.package.MyPageBean"/> 0011 <jsp:useBean id="aRequestBean" scope="request" class="my.package.MyRequestBean"/> 0012 <% 0013 // We can decipher our expected parameters here. 0014 String parm1 = noNull(request.getParameter(PARAMETER_1)).trim(); 0015 String parm2 = noNull(request.getParameter(PARAMETER_2)).trim(); 0016 String parm3 = noNull(request.getParameter(PARAMETER_3)).trim(); 0017 String parm4 = noNull(request.getParameter(PARAMETER_4)).trim(); 0018 String parm5 = noNull(request.getParameter(PARAMETER_5)).trim(); 0019 0020 // A sample collection of Integers to display some code folding. 0021 List intList = getIntList(10); 0022 0023 0024 %> 0025 <html> 0026 <title>A Sample Jsp</title> 0027 <head> 0028 <script language="javascript"><!-- 0029 function doAlert1() { 0030 alert("This is the first javascript example."); 0031 } 0032 0033 function doAlert2() { 0034 alert("This is the second javascript example."); 0035 } 0036 //--></script> 0037 <style type="text/css"> 0038 body{ color: yellow; } 0039 </style> 0040 </head> 0041 <body> 0042 <%-- The top label table. --%> 0043 <table width="400" cellpadding="0" cellspacing="0" border="0"> 0044 <tr> 0045 <td><font size="3"><b>The following parameters were detected:</b></font></td> 0046 </tr> 0047 </table> 0048 0049 <%-- Display the parameters which might have been passed in. --%> 0050 <table width="400" cellpadding="0" cellspacing="0" border="0"> 0051 <%-- Label; Actual Parameter String; Value Detected --%> 0052 <tr> 0053 <td><b>PARAMETER_1</b></td> 0054 <td align="center"><%=PARAMETER_1%></td> 0055 <td align="right">"<%=parm1%>"</td> 0056 </tr> 0057 0058 <%-- Label; Actual Parameter String; Value Detected --%> 0059 <tr> 0060 <td><b>PARAMETER_2</b></td> 0061 <td align="center"><%=PARAMETER_2%></td> 0062 <td align="right">"<%=parm2%>"</td> 0063 </tr> 0064 0065 <%-- Label; Actual Parameter String; Value Detected --%> 0066 <tr> 0067 <td><b>PARAMETER_3</b></td> 0068 <td align="center"><%=PARAMETER_3%></td> 0069 <td align="right">"<%=parm3%>"</td> 0070 </tr> 0071 0072 <%-- Label; Actual Parameter String; Value Detected --%> 0073 <tr> 0074 <td><b>PARAMETER_4</b></td> 0075 <td align="center"><%=PARAMETER_4%></td> 0076 <td align="right">"<%=parm4%>"</td> 0077 </tr> 0078 0079 <%-- Label; Actual Parameter String; Value Detected --%> 0080 <tr> 0081 <td><b>PARAMETER_5</b></td> 0082 <td align="center"><%=PARAMETER_5%></td> 0083 <td align="right">"<%=parm5%>"</td> 0084 </tr> 0085 </table> 0086 0087 <br><br> 0088 0089 <%-- Display our list of random Integers (shows code folding). --%> 0090 <table width="400" cellpadding="0" cellspacing="0" border="0"> 0091 <% 0092 if (intList != null && intList.size() > 0) { 0093 %> 0094 <tr><td><b>Here are the elements of intList...</b></td></tr> 0095 <% 0096 Iterator intListIt = intList.iterator(); 0097 while (intListIt.hasNext()) { 0098 Integer i = (Integer) intListIt.next(); 0099 %> 0100 <tr><td><%=i.toString()%></td></tr> 0101 <% 0102 } 0103 } else { 0104 %> 0105 <tr><td><font color="blue"><b><i>Oooops, we forgot to initialize intList!</i></b></font></td></tr> 0106 <% 0107 } 0108 %> 0109 </table> 0110 0111 <br><br> 0112 0113 <%-- We can call javascript functions. --%> 0114 <table width="400" cellpadding="0" cellspacing="0" border="0"> 0115 <tr><td colspan="2"><b>Test our javascript...</b></td></tr> 0116 <tr> 0117 <td><input type="button" name="button1" value="Alert 1" onmouseup="javascript:doAlert1()"></td> 0118 <td><input type="button" name="button2" value="Alert 2" onmouseup="javascript:doAlert2()"></td> 0119 </tr> 0120 </table> 0121 0122 <br><br> 0123 <%-- If we actually had defined a tag library. --%> 0124 <table width="400" cellpadding="0" cellspacing="0" border="0"> 0125 <tr><td> 0126 <my:SampleTag prop1="first" prop2="third"> 0127 <my:SampleTagChild nameProp="value1"/> 0128 <my:SampleTagChild nameProp="value2"/> 0129 </my:SampleTag> 0130 </td></tr> 0131 </table> 0132 0133 <br><br> 0134 <%-- Expression language. --%> 0135 <table width="400" cellpadding="0" cellspacing="0" border="0"> 0136 <c:if test="${!empty param.aParam}"> 0137 <c:set var="myParam" scope="session" value="${param.aParam}"/> 0138 </c:if> 0139 0140 <tr><td>myParam's value: "<c:out value="${myParam}" default=="Default"/>"</td></tr> 0141 </table> 0142 </body> 0143 </html> 0144 <%! 0145 /* A place for class variables and functions... */ 0146 0147 // Define some sample parameter names that this page might understand. 0148 private static final String PARAMETER_1 = "p1"; 0149 private static final String PARAMETER_2 = "p2"; 0150 private static final String PARAMETER_3 = "p3"; 0151 private static final String PARAMETER_4 = "p4"; 0152 private static final String PARAMETER_5 = "p5"; 0153 0154 // Returns str trimmed, or an empty string if str is null. 0155 private static String noNull(String str) { 0156 String retStr; 0157 if (str == null) 0158 retStr = ""; 0159 else 0160 retStr = str.trim(); 0161 0162 return retStr; 0163 } 0164 0165 // Returns a list of Integers with listSize elements. 0166 private static List getIntList(int listSize) { 0167 ArrayList retList = new ArrayList(listSize); 0168 for (int i = 0; i < listSize; i++) 0169 retList.add(new Integer( (int) (Math.random() * 100) )); 0170 0171 return retList; 0172 } 0173 %>