Warning, /frameworks/syntax-highlighting/autotests/folding/highlight.jsp.fold is written in an unsupported language. File is not indexed.
0001 <beginfold id='1'><%--</beginfold id='1'> 0002 This page won't actually work, as it is simply designed to display jsp syntax highlighting. 0003 <endfold id='1'>--%></endfold id='1'> 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 <beginfold id='2'><%</beginfold id='2'> 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 <endfold id='2'>%></endfold id='2'> 0025 <html> 0026 <title>A Sample Jsp</title> 0027 <head> 0028 <beginfold id='3'><script</beginfold id='3'> language="javascript"><!-- 0029 function doAlert1() <beginfold id='4'>{</beginfold id='4'> 0030 alert("This is the first javascript example."); 0031 <endfold id='4'>}</endfold id='4'> 0032 0033 function doAlert2() <beginfold id='4'>{</beginfold id='4'> 0034 alert("This is the second javascript example."); 0035 <endfold id='4'>}</endfold id='4'> 0036 //--><endfold id='3'></script</endfold id='3'>> 0037 <beginfold id='5'><style</beginfold id='5'> type="text/css"> 0038 body<beginfold id='6'>{</beginfold id='6'> color: yellow; <endfold id='6'>}</endfold id='6'> 0039 <endfold id='5'></style></endfold id='5'> 0040 </head> 0041 <body> 0042 <beginfold id='1'><%--</beginfold id='1'> The top label table. <endfold id='1'>--%></endfold id='1'> 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 <beginfold id='1'><%--</beginfold id='1'> Display the parameters which might have been passed in. <endfold id='1'>--%></endfold id='1'> 0050 <table width="400" cellpadding="0" cellspacing="0" border="0"> 0051 <beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'> 0052 <tr> 0053 <td><b>PARAMETER_1</b></td> 0054 <td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_1<endfold id='2'>%></endfold id='2'></td> 0055 <td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm1<endfold id='2'>%></endfold id='2'>"</td> 0056 </tr> 0057 0058 <beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'> 0059 <tr> 0060 <td><b>PARAMETER_2</b></td> 0061 <td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_2<endfold id='2'>%></endfold id='2'></td> 0062 <td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm2<endfold id='2'>%></endfold id='2'>"</td> 0063 </tr> 0064 0065 <beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'> 0066 <tr> 0067 <td><b>PARAMETER_3</b></td> 0068 <td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_3<endfold id='2'>%></endfold id='2'></td> 0069 <td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm3<endfold id='2'>%></endfold id='2'>"</td> 0070 </tr> 0071 0072 <beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'> 0073 <tr> 0074 <td><b>PARAMETER_4</b></td> 0075 <td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_4<endfold id='2'>%></endfold id='2'></td> 0076 <td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm4<endfold id='2'>%></endfold id='2'>"</td> 0077 </tr> 0078 0079 <beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'> 0080 <tr> 0081 <td><b>PARAMETER_5</b></td> 0082 <td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_5<endfold id='2'>%></endfold id='2'></td> 0083 <td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm5<endfold id='2'>%></endfold id='2'>"</td> 0084 </tr> 0085 </table> 0086 0087 <br><br> 0088 0089 <beginfold id='1'><%--</beginfold id='1'> Display our list of random Integers (shows code folding). <endfold id='1'>--%></endfold id='1'> 0090 <table width="400" cellpadding="0" cellspacing="0" border="0"> 0091 <beginfold id='2'><%</beginfold id='2'> 0092 if (intList != null && intList.size() > 0) <beginfold id='7'>{</beginfold id='7'> 0093 <endfold id='2'>%></endfold id='2'> 0094 <tr><td><b>Here are the elements of intList...</b></td></tr> 0095 <beginfold id='2'><%</beginfold id='2'> 0096 Iterator intListIt = intList.iterator(); 0097 while (intListIt.hasNext()) <beginfold id='7'>{</beginfold id='7'> 0098 Integer i = (Integer) intListIt.next(); 0099 <endfold id='2'>%></endfold id='2'> 0100 <tr><td><beginfold id='2'><%=</beginfold id='2'>i.toString()<endfold id='2'>%></endfold id='2'></td></tr> 0101 <beginfold id='2'><%</beginfold id='2'> 0102 <endfold id='7'>}</endfold id='7'> 0103 <endfold id='7'>}</endfold id='7'> else <beginfold id='7'>{</beginfold id='7'> 0104 <endfold id='2'>%></endfold id='2'> 0105 <tr><td><font color="blue"><b><i>Oooops, we forgot to initialize intList!</i></b></font></td></tr> 0106 <beginfold id='2'><%</beginfold id='2'> 0107 <endfold id='7'>}</endfold id='7'> 0108 <endfold id='2'>%></endfold id='2'> 0109 </table> 0110 0111 <br><br> 0112 0113 <beginfold id='1'><%--</beginfold id='1'> We can call javascript functions. <endfold id='1'>--%></endfold id='1'> 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 <beginfold id='1'><%--</beginfold id='1'> If we actually had defined a tag library. <endfold id='1'>--%></endfold id='1'> 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 <beginfold id='1'><%--</beginfold id='1'> Expression language. <endfold id='1'>--%></endfold id='1'> 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 <beginfold id='2'><%!</beginfold id='2'> 0145 <beginfold id='8'>/*</beginfold id='8'> A place for class variables and functions... <endfold id='8'>*/</endfold id='8'> 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) <beginfold id='7'>{</beginfold id='7'> 0156 String retStr; 0157 if (str == null) 0158 retStr = ""; 0159 else 0160 retStr = str.trim(); 0161 0162 return retStr; 0163 <endfold id='7'>}</endfold id='7'> 0164 0165 // Returns a list of Integers with listSize elements. 0166 private static List getIntList(int listSize) <beginfold id='7'>{</beginfold id='7'> 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 <endfold id='7'>}</endfold id='7'> 0173 <endfold id='2'>%></endfold id='2'>