소스 파일 최초 업로드
This commit is contained in:
28
tomcat/webapps.dist/examples/jsp/async/async1.jsp
Normal file
28
tomcat/webapps.dist/examples/jsp/async/async1.jsp
Normal file
@@ -0,0 +1,28 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@page session="false" import="java.util.Date,java.text.SimpleDateFormat"%>
|
||||
Output from async1.jsp
|
||||
Type is <%=request.getDispatcherType()%>
|
||||
<%
|
||||
System.out.println("Inside Async 1");
|
||||
if (request.isAsyncStarted()) {
|
||||
request.getAsyncContext().complete();
|
||||
}
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
|
||||
%>
|
||||
Completed async request at <%=sdf.format(date)%>
|
||||
29
tomcat/webapps.dist/examples/jsp/async/async1.jsp.html
Normal file
29
tomcat/webapps.dist/examples/jsp/async/async1.jsp.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@page session="false" import="java.util.Date,java.text.SimpleDateFormat"%>
|
||||
Output from async1.jsp
|
||||
Type is <%=request.getDispatcherType()%>
|
||||
<%
|
||||
System.out.println("Inside Async 1");
|
||||
if (request.isAsyncStarted()) {
|
||||
request.getAsyncContext().complete();
|
||||
}
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
|
||||
%>
|
||||
Completed async request at <%=sdf.format(date)%>
|
||||
</pre></body></html>
|
||||
25
tomcat/webapps.dist/examples/jsp/async/async3.jsp
Normal file
25
tomcat/webapps.dist/examples/jsp/async/async3.jsp
Normal file
@@ -0,0 +1,25 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@page session="false" import="java.util.Date,java.text.SimpleDateFormat"%>
|
||||
Output from async3.jsp
|
||||
Type is <%=request.getDispatcherType()%>
|
||||
<%
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
|
||||
%>
|
||||
|
||||
Completed async 3 request at <%=sdf.format(date)%>
|
||||
26
tomcat/webapps.dist/examples/jsp/async/async3.jsp.html
Normal file
26
tomcat/webapps.dist/examples/jsp/async/async3.jsp.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@page session="false" import="java.util.Date,java.text.SimpleDateFormat"%>
|
||||
Output from async3.jsp
|
||||
Type is <%=request.getDispatcherType()%>
|
||||
<%
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
|
||||
%>
|
||||
|
||||
Completed async 3 request at <%=sdf.format(date)%>
|
||||
</pre></body></html>
|
||||
69
tomcat/webapps.dist/examples/jsp/async/index.jsp
Normal file
69
tomcat/webapps.dist/examples/jsp/async/index.jsp
Normal file
@@ -0,0 +1,69 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@page session="false"%>
|
||||
|
||||
<pre>
|
||||
Use cases:
|
||||
|
||||
1. Simple dispatch
|
||||
- servlet does startAsync()
|
||||
- background thread calls ctx.dispatch()
|
||||
<a href="<%=response.encodeURL("/examples/async/async0")%>"> Async 0 </a>
|
||||
|
||||
2. Simple dispatch
|
||||
- servlet does startAsync()
|
||||
- background thread calls dispatch(/path/to/jsp)
|
||||
<a href="<%=response.encodeURL("/examples/async/async1")%>"> Async 1 </a>
|
||||
|
||||
3. Simple dispatch
|
||||
- servlet does startAsync()
|
||||
- background thread calls writes and calls complete()
|
||||
<a href="<%=response.encodeURL("/examples/async/async2")%>"> Async 2 </a>
|
||||
|
||||
4. Simple dispatch
|
||||
- servlet does a startAsync()
|
||||
- servlet calls dispatch(/path/to/jsp)
|
||||
- servlet calls complete()
|
||||
<a href="<%=response.encodeURL("/examples/async/async3")%>"> Async 3 </a>
|
||||
|
||||
3. Timeout s1
|
||||
- servlet does a startAsync()
|
||||
- servlet does a setAsyncTimeout
|
||||
- returns - waits for timeout to happen should return error page
|
||||
|
||||
4. Timeout s2
|
||||
- servlet does a startAsync()
|
||||
- servlet does a setAsyncTimeout
|
||||
- servlet does a addAsyncListener
|
||||
- returns - waits for timeout to happen and listener invoked
|
||||
|
||||
5. Dispatch to asyncSupported=false servlet
|
||||
- servlet1 does a startAsync()
|
||||
- servlet1 dispatches to dispatch(/servlet2)
|
||||
- the container calls complete() after servlet2 is complete
|
||||
- TODO
|
||||
|
||||
6. Chained dispatch
|
||||
- servlet1 does a startAsync
|
||||
- servlet1 does a dispatch to servlet2 (asyncsupported=true)
|
||||
- servlet2 does a dispatch to servlet3 (asyncsupported=true)
|
||||
- servlet3 does a dispatch to servlet4 (asyncsupported=false)
|
||||
|
||||
|
||||
7. Stock ticker
|
||||
<a href="<%=response.encodeURL("/examples/async/stockticker")%>"> StockTicker </a>
|
||||
</pre>
|
||||
70
tomcat/webapps.dist/examples/jsp/async/index.jsp.html
Normal file
70
tomcat/webapps.dist/examples/jsp/async/index.jsp.html
Normal file
@@ -0,0 +1,70 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@page session="false"%>
|
||||
|
||||
<pre>
|
||||
Use cases:
|
||||
|
||||
1. Simple dispatch
|
||||
- servlet does startAsync()
|
||||
- background thread calls ctx.dispatch()
|
||||
<a href="<%=response.encodeURL("/examples/async/async0")%>"> Async 0 </a>
|
||||
|
||||
2. Simple dispatch
|
||||
- servlet does startAsync()
|
||||
- background thread calls dispatch(/path/to/jsp)
|
||||
<a href="<%=response.encodeURL("/examples/async/async1")%>"> Async 1 </a>
|
||||
|
||||
3. Simple dispatch
|
||||
- servlet does startAsync()
|
||||
- background thread calls writes and calls complete()
|
||||
<a href="<%=response.encodeURL("/examples/async/async2")%>"> Async 2 </a>
|
||||
|
||||
4. Simple dispatch
|
||||
- servlet does a startAsync()
|
||||
- servlet calls dispatch(/path/to/jsp)
|
||||
- servlet calls complete()
|
||||
<a href="<%=response.encodeURL("/examples/async/async3")%>"> Async 3 </a>
|
||||
|
||||
3. Timeout s1
|
||||
- servlet does a startAsync()
|
||||
- servlet does a setAsyncTimeout
|
||||
- returns - waits for timeout to happen should return error page
|
||||
|
||||
4. Timeout s2
|
||||
- servlet does a startAsync()
|
||||
- servlet does a setAsyncTimeout
|
||||
- servlet does a addAsyncListener
|
||||
- returns - waits for timeout to happen and listener invoked
|
||||
|
||||
5. Dispatch to asyncSupported=false servlet
|
||||
- servlet1 does a startAsync()
|
||||
- servlet1 dispatches to dispatch(/servlet2)
|
||||
- the container calls complete() after servlet2 is complete
|
||||
- TODO
|
||||
|
||||
6. Chained dispatch
|
||||
- servlet1 does a startAsync
|
||||
- servlet1 does a dispatch to servlet2 (asyncsupported=true)
|
||||
- servlet2 does a dispatch to servlet3 (asyncsupported=true)
|
||||
- servlet3 does a dispatch to servlet4 (asyncsupported=false)
|
||||
|
||||
|
||||
7. Stock ticker
|
||||
<a href="<%=response.encodeURL("/examples/async/stockticker")%>"> StockTicker </a>
|
||||
</pre>
|
||||
</pre></body></html>
|
||||
64
tomcat/webapps.dist/examples/jsp/cal/Entries.java.html
Normal file
64
tomcat/webapps.dist/examples/jsp/cal/Entries.java.html
Normal file
@@ -0,0 +1,64 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cal;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class Entries {
|
||||
|
||||
private final Map<String, Entry> entries;
|
||||
private static final String[] time = { "8am", "9am", "10am", "11am",
|
||||
"12pm", "1pm", "2pm", "3pm", "4pm", "5pm", "6pm", "7pm", "8pm" };
|
||||
public static final int rows = 12;
|
||||
|
||||
public Entries() {
|
||||
entries = new ConcurrentHashMap<>(rows);
|
||||
for (int i = 0; i < rows; i++) {
|
||||
entries.put(time[i], new Entry(time[i]));
|
||||
}
|
||||
}
|
||||
|
||||
public int getRows() {
|
||||
return rows;
|
||||
}
|
||||
|
||||
public Entry getEntry(int index) {
|
||||
return this.entries.get(time[index]);
|
||||
}
|
||||
|
||||
public int getIndex(String tm) {
|
||||
for (int i = 0; i < rows; i++) {
|
||||
if (tm.equals(time[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void processRequest(HttpServletRequest request, String tm) {
|
||||
int index = getIndex(tm);
|
||||
if (index >= 0) {
|
||||
String descr = request.getParameter("description");
|
||||
entries.get(time[index]).setDescription(descr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</pre></body></html>
|
||||
53
tomcat/webapps.dist/examples/jsp/cal/Entry.java.html
Normal file
53
tomcat/webapps.dist/examples/jsp/cal/Entry.java.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cal;
|
||||
|
||||
public class Entry {
|
||||
|
||||
final String hour;
|
||||
String description;
|
||||
|
||||
public Entry(String hour) {
|
||||
this.hour = hour;
|
||||
this.description = "";
|
||||
|
||||
}
|
||||
|
||||
public String getHour() {
|
||||
return this.hour;
|
||||
}
|
||||
|
||||
public String getColor() {
|
||||
if (description.equals("")) {
|
||||
return "lightblue";
|
||||
}
|
||||
return "red";
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
if (description.equals("")) {
|
||||
return "None";
|
||||
}
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String descr) {
|
||||
description = descr;
|
||||
}
|
||||
|
||||
}
|
||||
</pre></body></html>
|
||||
153
tomcat/webapps.dist/examples/jsp/cal/JspCalendar.java.html
Normal file
153
tomcat/webapps.dist/examples/jsp/cal/JspCalendar.java.html
Normal file
@@ -0,0 +1,153 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cal;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class JspCalendar {
|
||||
final Calendar calendar;
|
||||
|
||||
public JspCalendar() {
|
||||
calendar = Calendar.getInstance();
|
||||
Date trialTime = new Date();
|
||||
calendar.setTime(trialTime);
|
||||
}
|
||||
|
||||
|
||||
public int getYear() {
|
||||
return calendar.get(Calendar.YEAR);
|
||||
}
|
||||
|
||||
public String getMonth() {
|
||||
int m = getMonthInt();
|
||||
String[] months = new String [] { "January", "February", "March",
|
||||
"April", "May", "June",
|
||||
"July", "August", "September",
|
||||
"October", "November", "December" };
|
||||
if (m > 12) {
|
||||
return "Unknown to Man";
|
||||
}
|
||||
|
||||
return months[m - 1];
|
||||
|
||||
}
|
||||
|
||||
public String getDay() {
|
||||
int x = getDayOfWeek();
|
||||
String[] days = new String[] {"Sunday", "Monday", "Tuesday", "Wednesday",
|
||||
"Thursday", "Friday", "Saturday"};
|
||||
|
||||
if (x > 7) {
|
||||
return "Unknown to Man";
|
||||
}
|
||||
|
||||
return days[x - 1];
|
||||
|
||||
}
|
||||
|
||||
public int getMonthInt() {
|
||||
return 1 + calendar.get(Calendar.MONTH);
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return getMonthInt() + "/" + getDayOfMonth() + "/" + getYear();
|
||||
}
|
||||
|
||||
public String getCurrentDate() {
|
||||
Date dt = new Date ();
|
||||
calendar.setTime (dt);
|
||||
return getMonthInt() + "/" + getDayOfMonth() + "/" + getYear();
|
||||
|
||||
}
|
||||
|
||||
public String getNextDate() {
|
||||
calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() + 1);
|
||||
return getDate ();
|
||||
}
|
||||
|
||||
public String getPrevDate() {
|
||||
calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() - 1);
|
||||
return getDate ();
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return getHour() + ":" + getMinute() + ":" + getSecond();
|
||||
}
|
||||
|
||||
public int getDayOfMonth() {
|
||||
return calendar.get(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
public int getDayOfYear() {
|
||||
return calendar.get(Calendar.DAY_OF_YEAR);
|
||||
}
|
||||
|
||||
public int getWeekOfYear() {
|
||||
return calendar.get(Calendar.WEEK_OF_YEAR);
|
||||
}
|
||||
|
||||
public int getWeekOfMonth() {
|
||||
return calendar.get(Calendar.WEEK_OF_MONTH);
|
||||
}
|
||||
|
||||
public int getDayOfWeek() {
|
||||
return calendar.get(Calendar.DAY_OF_WEEK);
|
||||
}
|
||||
|
||||
public int getHour() {
|
||||
return calendar.get(Calendar.HOUR_OF_DAY);
|
||||
}
|
||||
|
||||
public int getMinute() {
|
||||
return calendar.get(Calendar.MINUTE);
|
||||
}
|
||||
|
||||
|
||||
public int getSecond() {
|
||||
return calendar.get(Calendar.SECOND);
|
||||
}
|
||||
|
||||
|
||||
public int getEra() {
|
||||
return calendar.get(Calendar.ERA);
|
||||
}
|
||||
|
||||
public String getUSTimeZone() {
|
||||
String[] zones = new String[] {"Hawaii", "Alaskan", "Pacific",
|
||||
"Mountain", "Central", "Eastern"};
|
||||
|
||||
return zones[10 + getZoneOffset()];
|
||||
}
|
||||
|
||||
public int getZoneOffset() {
|
||||
return calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000);
|
||||
}
|
||||
|
||||
|
||||
public int getDSTOffset() {
|
||||
return calendar.get(Calendar.DST_OFFSET)/(60*60*1000);
|
||||
}
|
||||
|
||||
|
||||
public int getAMPM() {
|
||||
return calendar.get(Calendar.AM_PM);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</pre></body></html>
|
||||
107
tomcat/webapps.dist/examples/jsp/cal/TableBean.java.html
Normal file
107
tomcat/webapps.dist/examples/jsp/cal/TableBean.java.html
Normal file
@@ -0,0 +1,107 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cal;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class TableBean {
|
||||
|
||||
private final Map<String, Entries> table;
|
||||
private final JspCalendar JspCal;
|
||||
private Entries entries;
|
||||
private String date;
|
||||
private String name = null;
|
||||
private String email = null;
|
||||
private boolean processError = false;
|
||||
|
||||
public TableBean() {
|
||||
this.table = new ConcurrentHashMap<>(10);
|
||||
this.JspCal = new JspCalendar();
|
||||
this.date = JspCal.getCurrentDate();
|
||||
}
|
||||
|
||||
public void setName(String nm) {
|
||||
this.name = nm;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setEmail(String mail) {
|
||||
this.email = mail;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return this.email;
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return this.date;
|
||||
}
|
||||
|
||||
public Entries getEntries() {
|
||||
return this.entries;
|
||||
}
|
||||
|
||||
public void processRequest(HttpServletRequest request) {
|
||||
|
||||
// Get the name and e-mail.
|
||||
this.processError = false;
|
||||
if (name == null || name.equals("")) {
|
||||
setName(request.getParameter("name"));
|
||||
}
|
||||
if (email == null || email.equals("")) {
|
||||
setEmail(request.getParameter("email"));
|
||||
}
|
||||
if (name == null || email == null || name.equals("")
|
||||
|| email.equals("")) {
|
||||
this.processError = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the date.
|
||||
String dateR = request.getParameter("date");
|
||||
if (dateR == null) {
|
||||
date = JspCal.getCurrentDate();
|
||||
} else if (dateR.equalsIgnoreCase("next")) {
|
||||
date = JspCal.getNextDate();
|
||||
} else if (dateR.equalsIgnoreCase("prev")) {
|
||||
date = JspCal.getPrevDate();
|
||||
}
|
||||
|
||||
entries = table.get(date);
|
||||
if (entries == null) {
|
||||
entries = new Entries();
|
||||
table.put(date, entries);
|
||||
}
|
||||
|
||||
// If time is provided add the event.
|
||||
String time = request.getParameter("time");
|
||||
if (time != null) {
|
||||
entries.processRequest(request, time);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getProcessError() {
|
||||
return this.processError;
|
||||
}
|
||||
}
|
||||
</pre></body></html>
|
||||
94
tomcat/webapps.dist/examples/jsp/cal/cal1.jsp
Normal file
94
tomcat/webapps.dist/examples/jsp/cal/cal1.jsp
Normal file
@@ -0,0 +1,94 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@page contentType="text/html; charset=UTF-8" %>
|
||||
<HTML>
|
||||
<HEAD><TITLE>
|
||||
Calendar: A JSP APPLICATION
|
||||
</TITLE></HEAD>
|
||||
|
||||
|
||||
<BODY BGCOLOR="white">
|
||||
|
||||
<%@ page language="java" import="cal.*" %>
|
||||
<jsp:useBean id="table" scope="session" class="cal.TableBean" />
|
||||
|
||||
<%
|
||||
table.processRequest(request);
|
||||
if (table.getProcessError() == false) {
|
||||
%>
|
||||
|
||||
<!-- HTML table goes here -->
|
||||
<CENTER>
|
||||
<TABLE WIDTH=60% BGCOLOR=yellow CELLPADDING=15>
|
||||
<TR>
|
||||
<TD ALIGN=CENTER> <A HREF=cal1.jsp?date=prev> prev </A>
|
||||
<TD ALIGN=CENTER> Calendar:<%= table.getDate() %></TD>
|
||||
<TD ALIGN=CENTER> <A HREF=cal1.jsp?date=next> next </A>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<!-- the main table -->
|
||||
<TABLE WIDTH=60% BGCOLOR=lightblue BORDER=1 CELLPADDING=10>
|
||||
<TR>
|
||||
<TH> Time </TH>
|
||||
<TH> Appointment </TH>
|
||||
</TR>
|
||||
<FORM METHOD=POST ACTION=cal1.jsp>
|
||||
<%
|
||||
for(int i=0; i<table.getEntries().getRows(); i++) {
|
||||
cal.Entry entr = table.getEntries().getEntry(i);
|
||||
%>
|
||||
<TR>
|
||||
<TD>
|
||||
<A HREF=cal2.jsp?time=<%= entr.getHour() %>>
|
||||
<%= entr.getHour() %> </A>
|
||||
</TD>
|
||||
<TD BGCOLOR=<%= entr.getColor() %>>
|
||||
<% out.print(util.HTMLFilter.filter(entr.getDescription())); %>
|
||||
</TD>
|
||||
</TR>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
</FORM>
|
||||
</TABLE>
|
||||
<BR>
|
||||
|
||||
<!-- footer -->
|
||||
<TABLE WIDTH=60% BGCOLOR=yellow CELLPADDING=15>
|
||||
<TR>
|
||||
<TD ALIGN=CENTER> <% out.print(util.HTMLFilter.filter(table.getName())); %> :
|
||||
<% out.print(util.HTMLFilter.filter(table.getEmail())); %> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</CENTER>
|
||||
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
<font size=5>
|
||||
You must enter your name and email address correctly.
|
||||
</font>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
|
||||
95
tomcat/webapps.dist/examples/jsp/cal/cal1.jsp.html
Normal file
95
tomcat/webapps.dist/examples/jsp/cal/cal1.jsp.html
Normal file
@@ -0,0 +1,95 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@page contentType="text/html; charset=UTF-8" %>
|
||||
<HTML>
|
||||
<HEAD><TITLE>
|
||||
Calendar: A JSP APPLICATION
|
||||
</TITLE></HEAD>
|
||||
|
||||
|
||||
<BODY BGCOLOR="white">
|
||||
|
||||
<%@ page language="java" import="cal.*" %>
|
||||
<jsp:useBean id="table" scope="session" class="cal.TableBean" />
|
||||
|
||||
<%
|
||||
table.processRequest(request);
|
||||
if (table.getProcessError() == false) {
|
||||
%>
|
||||
|
||||
<!-- HTML table goes here -->
|
||||
<CENTER>
|
||||
<TABLE WIDTH=60% BGCOLOR=yellow CELLPADDING=15>
|
||||
<TR>
|
||||
<TD ALIGN=CENTER> <A HREF=cal1.jsp?date=prev> prev </A>
|
||||
<TD ALIGN=CENTER> Calendar:<%= table.getDate() %></TD>
|
||||
<TD ALIGN=CENTER> <A HREF=cal1.jsp?date=next> next </A>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<!-- the main table -->
|
||||
<TABLE WIDTH=60% BGCOLOR=lightblue BORDER=1 CELLPADDING=10>
|
||||
<TR>
|
||||
<TH> Time </TH>
|
||||
<TH> Appointment </TH>
|
||||
</TR>
|
||||
<FORM METHOD=POST ACTION=cal1.jsp>
|
||||
<%
|
||||
for(int i=0; i<table.getEntries().getRows(); i++) {
|
||||
cal.Entry entr = table.getEntries().getEntry(i);
|
||||
%>
|
||||
<TR>
|
||||
<TD>
|
||||
<A HREF=cal2.jsp?time=<%= entr.getHour() %>>
|
||||
<%= entr.getHour() %> </A>
|
||||
</TD>
|
||||
<TD BGCOLOR=<%= entr.getColor() %>>
|
||||
<% out.print(util.HTMLFilter.filter(entr.getDescription())); %>
|
||||
</TD>
|
||||
</TR>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
</FORM>
|
||||
</TABLE>
|
||||
<BR>
|
||||
|
||||
<!-- footer -->
|
||||
<TABLE WIDTH=60% BGCOLOR=yellow CELLPADDING=15>
|
||||
<TR>
|
||||
<TD ALIGN=CENTER> <% out.print(util.HTMLFilter.filter(table.getName())); %> :
|
||||
<% out.print(util.HTMLFilter.filter(table.getEmail())); %> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</CENTER>
|
||||
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
<font size=5>
|
||||
You must enter your name and email address correctly.
|
||||
</font>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
|
||||
</pre></body></html>
|
||||
45
tomcat/webapps.dist/examples/jsp/cal/cal2.jsp
Normal file
45
tomcat/webapps.dist/examples/jsp/cal/cal2.jsp
Normal file
@@ -0,0 +1,45 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@page contentType="text/html; charset=UTF-8" %>
|
||||
<HTML>
|
||||
<HEAD><TITLE>
|
||||
Calendar: A JSP APPLICATION
|
||||
</TITLE></HEAD>
|
||||
|
||||
|
||||
<BODY BGCOLOR="white">
|
||||
<jsp:useBean id="table" scope="session" class="cal.TableBean" />
|
||||
|
||||
<%
|
||||
String time = request.getParameter ("time");
|
||||
%>
|
||||
|
||||
<FONT SIZE=5> Please add the following event:
|
||||
<BR> <h3> Date <%= table.getDate() %>
|
||||
<BR> Time <%= util.HTMLFilter.filter(time) %> </h3>
|
||||
</FONT>
|
||||
<FORM METHOD=POST ACTION=cal1.jsp>
|
||||
<BR>
|
||||
<BR> <INPUT NAME="date" TYPE=HIDDEN VALUE="current">
|
||||
<BR> <INPUT NAME="time" TYPE=HIDDEN VALUE="<%= util.HTMLFilter.filter(time) %>">
|
||||
<BR> <h2> Description of the event <INPUT NAME="description" TYPE=TEXT SIZE=20> </h2>
|
||||
<BR> <INPUT TYPE=SUBMIT VALUE="submit">
|
||||
</FORM>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
46
tomcat/webapps.dist/examples/jsp/cal/cal2.jsp.html
Normal file
46
tomcat/webapps.dist/examples/jsp/cal/cal2.jsp.html
Normal file
@@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@page contentType="text/html; charset=UTF-8" %>
|
||||
<HTML>
|
||||
<HEAD><TITLE>
|
||||
Calendar: A JSP APPLICATION
|
||||
</TITLE></HEAD>
|
||||
|
||||
|
||||
<BODY BGCOLOR="white">
|
||||
<jsp:useBean id="table" scope="session" class="cal.TableBean" />
|
||||
|
||||
<%
|
||||
String time = request.getParameter ("time");
|
||||
%>
|
||||
|
||||
<FONT SIZE=5> Please add the following event:
|
||||
<BR> <h3> Date <%= table.getDate() %>
|
||||
<BR> Time <%= util.HTMLFilter.filter(time) %> </h3>
|
||||
</FONT>
|
||||
<FORM METHOD=POST ACTION=cal1.jsp>
|
||||
<BR>
|
||||
<BR> <INPUT NAME="date" TYPE=HIDDEN VALUE="current">
|
||||
<BR> <INPUT NAME="time" TYPE=HIDDEN VALUE="<%= util.HTMLFilter.filter(time) %>">
|
||||
<BR> <h2> Description of the event <INPUT NAME="description" TYPE=TEXT SIZE=20> </h2>
|
||||
<BR> <INPUT TYPE=SUBMIT VALUE="submit">
|
||||
</FORM>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
</pre></body></html>
|
||||
43
tomcat/webapps.dist/examples/jsp/cal/calendar.html
Normal file
43
tomcat/webapps.dist/examples/jsp/cal/calendar.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<head>
|
||||
<title>Untitled Document</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="login.html"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h2> Source Code for Calendar Example. <br>
|
||||
<h3><a href="cal1.jsp.html">cal1.jsp<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
<h3><a href="cal2.jsp.html">cal2.jsp<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
<br>
|
||||
<h2> Beans.
|
||||
<h3><a href="TableBean.java.html">TableBean<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
<h3><a href="Entries.java.html">Entries<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
<h3><a href="Entry.java.html">Entry<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
47
tomcat/webapps.dist/examples/jsp/cal/login.html
Normal file
47
tomcat/webapps.dist/examples/jsp/cal/login.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<head>
|
||||
<title> Login page for the calendar. </title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="white">
|
||||
<center>
|
||||
|
||||
<font size=7 color="red"> Please Enter the following information: </font>
|
||||
|
||||
<br>
|
||||
<form method=GET action=cal1.jsp>
|
||||
|
||||
<font size=5> Name <input type=text name="name" size=20>
|
||||
</font>
|
||||
<br>
|
||||
<font size=5> Email <input type=text name="email" size=20>
|
||||
</font>
|
||||
<br>
|
||||
<input type=submit name=action value="Submit">
|
||||
|
||||
</form>
|
||||
<hr>
|
||||
<font size=3 color="red"> Note: This application does not implement the complete
|
||||
functionality of a typical calendar application. It demonstrates a way JSP can
|
||||
be used with HTML tables and forms.</font>
|
||||
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
56
tomcat/webapps.dist/examples/jsp/checkbox/CheckTest.html
Normal file
56
tomcat/webapps.dist/examples/jsp/checkbox/CheckTest.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<HTML>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<HEAD>
|
||||
<title>
|
||||
checkbox.CheckTest Bean Properties
|
||||
</title>
|
||||
<BODY BGCOLOR="white">
|
||||
<H2>
|
||||
checkbox.CheckTest Bean Properties
|
||||
</H2>
|
||||
<HR>
|
||||
<DL>
|
||||
<DT>public class <B>CheckTest</B><DT>extends Object</DL>
|
||||
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
<P>
|
||||
|
||||
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0">
|
||||
<TR BGCOLOR="#EEEEFF">
|
||||
<TD COLSPAN=3><FONT SIZE="+2">
|
||||
<B>Properties Summary</B></FONT></TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white">
|
||||
<td align="right" valign="top" width="1%">
|
||||
<FONT SIZE="-1">
|
||||
String
|
||||
</FONT></TD>
|
||||
<TD><B>CheckTest:fruit</B>
|
||||
<BR>
|
||||
</TD>
|
||||
<td width="1%">
|
||||
<FONT SIZE="-1">
|
||||
Multi
|
||||
</FONT></TD>
|
||||
</TABLE>
|
||||
<HR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
38
tomcat/webapps.dist/examples/jsp/checkbox/check.html
Normal file
38
tomcat/webapps.dist/examples/jsp/checkbox/check.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<HTML>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<BODY bgcolor="white">
|
||||
|
||||
|
||||
<FORM TYPE=POST ACTION=checkresult.jsp>
|
||||
<BR>
|
||||
<font size=5 color="red">
|
||||
Check all Favorite fruits: <br>
|
||||
|
||||
<input TYPE=checkbox name=fruit VALUE=apples> Apples <BR>
|
||||
<input TYPE=checkbox name=fruit VALUE=grapes> Grapes <BR>
|
||||
<input TYPE=checkbox name=fruit VALUE=oranges> Oranges <BR>
|
||||
<input TYPE=checkbox name=fruit VALUE=melons> Melons <BR>
|
||||
|
||||
|
||||
<br> <INPUT TYPE=submit name=submit Value="Submit">
|
||||
|
||||
</font>
|
||||
</FORM>
|
||||
</BODY>
|
||||
</HTML>
|
||||
65
tomcat/webapps.dist/examples/jsp/checkbox/checkresult.jsp
Normal file
65
tomcat/webapps.dist/examples/jsp/checkbox/checkresult.jsp
Normal file
@@ -0,0 +1,65 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
<body bgcolor="white">
|
||||
<font size=5 color="red">
|
||||
<%! String[] fruits; %>
|
||||
<jsp:useBean id="foo" scope="page" class="checkbox.CheckTest" />
|
||||
|
||||
<jsp:setProperty name="foo" property="fruit" param="fruit" />
|
||||
<hr>
|
||||
The checked fruits (got using request) are: <br>
|
||||
<%
|
||||
fruits = request.getParameterValues("fruit");
|
||||
%>
|
||||
<ul>
|
||||
<%
|
||||
if (fruits != null) {
|
||||
for (String fruit : fruits) {
|
||||
%>
|
||||
<li>
|
||||
<%
|
||||
out.println (util.HTMLFilter.filter(fruit));
|
||||
}
|
||||
} else out.println ("none selected");
|
||||
%>
|
||||
</ul>
|
||||
<br>
|
||||
<hr>
|
||||
|
||||
The checked fruits (got using beans) are <br>
|
||||
|
||||
<%
|
||||
fruits = foo.getFruit();
|
||||
%>
|
||||
<ul>
|
||||
<%
|
||||
if (!fruits[0].equals("1")) {
|
||||
for (String fruit : fruits) {
|
||||
%>
|
||||
<li>
|
||||
<%
|
||||
out.println (util.HTMLFilter.filter(fruit));
|
||||
}
|
||||
} else {
|
||||
out.println ("none selected");
|
||||
}
|
||||
%>
|
||||
</ul>
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,66 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
<body bgcolor="white">
|
||||
<font size=5 color="red">
|
||||
<%! String[] fruits; %>
|
||||
<jsp:useBean id="foo" scope="page" class="checkbox.CheckTest" />
|
||||
|
||||
<jsp:setProperty name="foo" property="fruit" param="fruit" />
|
||||
<hr>
|
||||
The checked fruits (got using request) are: <br>
|
||||
<%
|
||||
fruits = request.getParameterValues("fruit");
|
||||
%>
|
||||
<ul>
|
||||
<%
|
||||
if (fruits != null) {
|
||||
for (String fruit : fruits) {
|
||||
%>
|
||||
<li>
|
||||
<%
|
||||
out.println (util.HTMLFilter.filter(fruit));
|
||||
}
|
||||
} else out.println ("none selected");
|
||||
%>
|
||||
</ul>
|
||||
<br>
|
||||
<hr>
|
||||
|
||||
The checked fruits (got using beans) are <br>
|
||||
|
||||
<%
|
||||
fruits = foo.getFruit();
|
||||
%>
|
||||
<ul>
|
||||
<%
|
||||
if (!fruits[0].equals("1")) {
|
||||
for (String fruit : fruits) {
|
||||
%>
|
||||
<li>
|
||||
<%
|
||||
out.println (util.HTMLFilter.filter(fruit));
|
||||
}
|
||||
} else {
|
||||
out.println ("none selected");
|
||||
}
|
||||
%>
|
||||
</ul>
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
||||
34
tomcat/webapps.dist/examples/jsp/checkbox/cresult.html
Normal file
34
tomcat/webapps.dist/examples/jsp/checkbox/cresult.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<head>
|
||||
<title>Untitled Document</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="check.html"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="checkresult.jsp.html">Source Code for Checkbox Example<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
<h3><a href="CheckTest.html">Property Sheet for CheckTest
|
||||
<font color="#0000FF"></a> </font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
116
tomcat/webapps.dist/examples/jsp/colors/ColorGameBean.html
Normal file
116
tomcat/webapps.dist/examples/jsp/colors/ColorGameBean.html
Normal file
@@ -0,0 +1,116 @@
|
||||
<HTML>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<HEAD>
|
||||
<title>
|
||||
colors.ColorGameBean Bean Properties
|
||||
</title>
|
||||
<BODY BGCOLOR="white">
|
||||
<H2>
|
||||
colors.ColorGameBean Bean Properties
|
||||
</H2>
|
||||
<HR>
|
||||
<DL>
|
||||
<DT>public class <B>ColorGameBean</B><DT>extends Object</DL>
|
||||
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
<P>
|
||||
|
||||
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0">
|
||||
<TR BGCOLOR="#EEEEFF">
|
||||
<TD COLSPAN=3><FONT SIZE="+2">
|
||||
<B>Properties Summary</B></FONT></TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white">
|
||||
<td align="right" valign="top" width="1%">
|
||||
<FONT SIZE="-1">
|
||||
String
|
||||
</FONT></TD>
|
||||
<TD><B>ColorGameBean:color2</B>
|
||||
<BR>
|
||||
</TD>
|
||||
<td width="1%">
|
||||
<FONT SIZE="-1">
|
||||
Single
|
||||
</FONT></TD>
|
||||
<TR BGCOLOR="white">
|
||||
<td align="right" valign="top" width="1%">
|
||||
<FONT SIZE="-1">
|
||||
String
|
||||
</FONT></TD>
|
||||
<TD><B>ColorGameBean:color1</B>
|
||||
<BR>
|
||||
</TD>
|
||||
<td width="1%">
|
||||
<FONT SIZE="-1">
|
||||
Single
|
||||
</FONT></TD>
|
||||
<TR BGCOLOR="white">
|
||||
<td align="right" valign="top" width="1%">
|
||||
<FONT SIZE="-1">
|
||||
int
|
||||
</FONT></TD>
|
||||
<TD><B>ColorGameBean:attempts</B>
|
||||
<BR>
|
||||
</TD>
|
||||
<td width="1%">
|
||||
<FONT SIZE="-1">
|
||||
Single
|
||||
</FONT></TD>
|
||||
<TR BGCOLOR="white">
|
||||
<td align="right" valign="top" width="1%">
|
||||
<FONT SIZE="-1">
|
||||
boolean
|
||||
</FONT></TD>
|
||||
<TD><B>ColorGameBean:hint</B>
|
||||
<BR>
|
||||
</TD>
|
||||
<td width="1%">
|
||||
<FONT SIZE="-1">
|
||||
Single
|
||||
</FONT></TD>
|
||||
<TR BGCOLOR="white">
|
||||
<td align="right" valign="top" width="1%">
|
||||
<FONT SIZE="-1">
|
||||
boolean
|
||||
</FONT></TD>
|
||||
<TD><B>ColorGameBean:success</B>
|
||||
<BR>
|
||||
</TD>
|
||||
<td width="1%">
|
||||
<FONT SIZE="-1">
|
||||
Single
|
||||
</FONT></TD>
|
||||
<TR BGCOLOR="white">
|
||||
<td align="right" valign="top" width="1%">
|
||||
<FONT SIZE="-1">
|
||||
boolean
|
||||
</FONT></TD>
|
||||
<TD><B>ColorGameBean:hintTaken</B>
|
||||
<BR>
|
||||
</TD>
|
||||
<td width="1%">
|
||||
<FONT SIZE="-1">
|
||||
Single
|
||||
</FONT></TD>
|
||||
</TABLE>
|
||||
<HR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
34
tomcat/webapps.dist/examples/jsp/colors/clr.html
Normal file
34
tomcat/webapps.dist/examples/jsp/colors/clr.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<head>
|
||||
<title>Untitled Document</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="colors.html"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="colrs.jsp.html">Source Code for Color Example<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
<h3><a href="ColorGameBean.html">Property Sheet for ColorGameBean
|
||||
<font color="#0000FF"></a> </font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
47
tomcat/webapps.dist/examples/jsp/colors/colors.html
Normal file
47
tomcat/webapps.dist/examples/jsp/colors/colors.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<body bgcolor= white>
|
||||
<font size=6 color=red>
|
||||
|
||||
<hr>
|
||||
This web page is an example using JSP and BEANs.
|
||||
<p>
|
||||
Guess my favorite two colors
|
||||
|
||||
<p> If you fail to guess both of them - you get yellow on red.
|
||||
|
||||
<p> If you guess one of them right, either your foreground or
|
||||
your background will change to the color that was guessed right.
|
||||
|
||||
<p> Guess them both right and your browser foreground/background
|
||||
will change to my two favorite colors to display this page.
|
||||
|
||||
<hr>
|
||||
<form method=GET action=colrs.jsp>
|
||||
Color #1: <input type=text name= color1 size=16>
|
||||
<br>
|
||||
Color #2: <input type=text name= color2 size=16>
|
||||
<p>
|
||||
<input type=submit name=action value="Submit">
|
||||
<input type=submit name=action value="Hint">
|
||||
</form>
|
||||
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
||||
70
tomcat/webapps.dist/examples/jsp/colors/colrs.jsp
Normal file
70
tomcat/webapps.dist/examples/jsp/colors/colrs.jsp
Normal file
@@ -0,0 +1,70 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
|
||||
<jsp:useBean id="cb" scope="session" class="colors.ColorGameBean" />
|
||||
<jsp:setProperty name="cb" property="*" />
|
||||
|
||||
<%
|
||||
cb.processRequest();
|
||||
%>
|
||||
|
||||
<body bgcolor=<%= cb.getColor1() %>>
|
||||
<font size=6 color=<%= cb.getColor2() %>>
|
||||
<p>
|
||||
|
||||
<% if (cb.getHint()==true) { %>
|
||||
|
||||
<p> Hint #1: Vampires prey at night!
|
||||
<p> <p> Hint #2: Nancy without the n.
|
||||
|
||||
<% } %>
|
||||
|
||||
<% if (cb.getSuccess()==true) { %>
|
||||
|
||||
<p> CONGRATULATIONS!!
|
||||
<% if (cb.getHintTaken()==true) { %>
|
||||
|
||||
<p> ( although I know you cheated and peeked into the hints)
|
||||
|
||||
<% } %>
|
||||
|
||||
<% } %>
|
||||
|
||||
<p> Total attempts so far: <%= cb.getAttempts() %>
|
||||
<p>
|
||||
|
||||
<p>
|
||||
|
||||
<form method=POST action=colrs.jsp>
|
||||
|
||||
Color #1: <input type=text name= color1 size=16>
|
||||
|
||||
<br>
|
||||
|
||||
Color #2: <input type=text name= color2 size=16>
|
||||
|
||||
<p>
|
||||
|
||||
<input type=submit name=action value="Submit">
|
||||
<input type=submit name=action value="Hint">
|
||||
|
||||
</form>
|
||||
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
||||
71
tomcat/webapps.dist/examples/jsp/colors/colrs.jsp.html
Normal file
71
tomcat/webapps.dist/examples/jsp/colors/colrs.jsp.html
Normal file
@@ -0,0 +1,71 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
|
||||
<jsp:useBean id="cb" scope="session" class="colors.ColorGameBean" />
|
||||
<jsp:setProperty name="cb" property="*" />
|
||||
|
||||
<%
|
||||
cb.processRequest();
|
||||
%>
|
||||
|
||||
<body bgcolor=<%= cb.getColor1() %>>
|
||||
<font size=6 color=<%= cb.getColor2() %>>
|
||||
<p>
|
||||
|
||||
<% if (cb.getHint()==true) { %>
|
||||
|
||||
<p> Hint #1: Vampires prey at night!
|
||||
<p> <p> Hint #2: Nancy without the n.
|
||||
|
||||
<% } %>
|
||||
|
||||
<% if (cb.getSuccess()==true) { %>
|
||||
|
||||
<p> CONGRATULATIONS!!
|
||||
<% if (cb.getHintTaken()==true) { %>
|
||||
|
||||
<p> ( although I know you cheated and peeked into the hints)
|
||||
|
||||
<% } %>
|
||||
|
||||
<% } %>
|
||||
|
||||
<p> Total attempts so far: <%= cb.getAttempts() %>
|
||||
<p>
|
||||
|
||||
<p>
|
||||
|
||||
<form method=POST action=colrs.jsp>
|
||||
|
||||
Color #1: <input type=text name= color1 size=16>
|
||||
|
||||
<br>
|
||||
|
||||
Color #2: <input type=text name= color2 size=16>
|
||||
|
||||
<p>
|
||||
|
||||
<input type=submit name=action value="Submit">
|
||||
<input type=submit name=action value="Hint">
|
||||
|
||||
</form>
|
||||
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
||||
31
tomcat/webapps.dist/examples/jsp/dates/date.html
Normal file
31
tomcat/webapps.dist/examples/jsp/dates/date.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<head>
|
||||
<title>Untitled Document</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="date.jsp"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="date.jsp.html">Source Code for Date Example<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
41
tomcat/webapps.dist/examples/jsp/dates/date.jsp
Normal file
41
tomcat/webapps.dist/examples/jsp/dates/date.jsp
Normal file
@@ -0,0 +1,41 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
|
||||
<%@ page session="false"%>
|
||||
|
||||
<body bgcolor="white">
|
||||
<jsp:useBean id='clock' scope='page' class='dates.JspCalendar' type="dates.JspCalendar" />
|
||||
|
||||
<font size=4>
|
||||
<ul>
|
||||
<li> Day of month: is <jsp:getProperty name="clock" property="dayOfMonth"/>
|
||||
<li> Year: is <jsp:getProperty name="clock" property="year"/>
|
||||
<li> Month: is <jsp:getProperty name="clock" property="month"/>
|
||||
<li> Time: is <jsp:getProperty name="clock" property="time"/>
|
||||
<li> Date: is <jsp:getProperty name="clock" property="date"/>
|
||||
<li> Day: is <jsp:getProperty name="clock" property="day"/>
|
||||
<li> Day Of Year: is <jsp:getProperty name="clock" property="dayOfYear"/>
|
||||
<li> Week Of Year: is <jsp:getProperty name="clock" property="weekOfYear"/>
|
||||
<li> era: is <jsp:getProperty name="clock" property="era"/>
|
||||
<li> DST Offset: is <jsp:getProperty name="clock" property="DSTOffset"/>
|
||||
<li> Zone Offset: is <jsp:getProperty name="clock" property="zoneOffset"/>
|
||||
</ul>
|
||||
</font>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
42
tomcat/webapps.dist/examples/jsp/dates/date.jsp.html
Normal file
42
tomcat/webapps.dist/examples/jsp/dates/date.jsp.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
|
||||
<%@ page session="false"%>
|
||||
|
||||
<body bgcolor="white">
|
||||
<jsp:useBean id='clock' scope='page' class='dates.JspCalendar' type="dates.JspCalendar" />
|
||||
|
||||
<font size=4>
|
||||
<ul>
|
||||
<li> Day of month: is <jsp:getProperty name="clock" property="dayOfMonth"/>
|
||||
<li> Year: is <jsp:getProperty name="clock" property="year"/>
|
||||
<li> Month: is <jsp:getProperty name="clock" property="month"/>
|
||||
<li> Time: is <jsp:getProperty name="clock" property="time"/>
|
||||
<li> Date: is <jsp:getProperty name="clock" property="date"/>
|
||||
<li> Day: is <jsp:getProperty name="clock" property="day"/>
|
||||
<li> Day Of Year: is <jsp:getProperty name="clock" property="dayOfYear"/>
|
||||
<li> Week Of Year: is <jsp:getProperty name="clock" property="weekOfYear"/>
|
||||
<li> era: is <jsp:getProperty name="clock" property="era"/>
|
||||
<li> DST Offset: is <jsp:getProperty name="clock" property="DSTOffset"/>
|
||||
<li> Zone Offset: is <jsp:getProperty name="clock" property="zoneOffset"/>
|
||||
</ul>
|
||||
</font>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
||||
31
tomcat/webapps.dist/examples/jsp/error/er.html
Normal file
31
tomcat/webapps.dist/examples/jsp/error/er.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<head>
|
||||
<title>Untitled Document</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="error.html"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="err.jsp.html">Source Code for Error Example<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
44
tomcat/webapps.dist/examples/jsp/error/err.jsp
Normal file
44
tomcat/webapps.dist/examples/jsp/error/err.jsp
Normal file
@@ -0,0 +1,44 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
<body bgcolor="lightblue">
|
||||
|
||||
<%@ page errorPage="errorpge.jsp" %>
|
||||
<jsp:useBean id="foo" scope="request" class="error.Smart" />
|
||||
<%
|
||||
String name = null;
|
||||
|
||||
if (request.getParameter("name") == null) {
|
||||
%>
|
||||
<%@ include file="error.html" %>
|
||||
<%
|
||||
} else {
|
||||
foo.setName(request.getParameter("name"));
|
||||
if (foo.getName().equalsIgnoreCase("integra"))
|
||||
name = "acura";
|
||||
if (name.equalsIgnoreCase("acura")) {
|
||||
%>
|
||||
|
||||
<H1> Yes!!! <a href="http://www.acura.com">Acura</a> is my favorite car.
|
||||
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
45
tomcat/webapps.dist/examples/jsp/error/err.jsp.html
Normal file
45
tomcat/webapps.dist/examples/jsp/error/err.jsp.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
<body bgcolor="lightblue">
|
||||
|
||||
<%@ page errorPage="errorpge.jsp" %>
|
||||
<jsp:useBean id="foo" scope="request" class="error.Smart" />
|
||||
<%
|
||||
String name = null;
|
||||
|
||||
if (request.getParameter("name") == null) {
|
||||
%>
|
||||
<%@ include file="error.html" %>
|
||||
<%
|
||||
} else {
|
||||
foo.setName(request.getParameter("name"));
|
||||
if (foo.getName().equalsIgnoreCase("integra"))
|
||||
name = "acura";
|
||||
if (name.equalsIgnoreCase("acura")) {
|
||||
%>
|
||||
|
||||
<H1> Yes!!! <a href="http://www.acura.com">Acura</a> is my favorite car.
|
||||
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</pre></body></html>
|
||||
37
tomcat/webapps.dist/examples/jsp/error/error.html
Normal file
37
tomcat/webapps.dist/examples/jsp/error/error.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<body bgcolor="white">
|
||||
|
||||
<h1> This example uses <b>errorpage</b> directive </h1>
|
||||
<br>
|
||||
<h3> Select my favourite car.</h3>
|
||||
<form method=get action=err.jsp>
|
||||
<!-- <br> Make a guess: -->
|
||||
<SELECT NAME="name" SIZE=5>
|
||||
<OPTION VALUE="integra"> Acura Integra <BR>
|
||||
<OPTION VALUE="bmw328i"> BMW 328I <BR>
|
||||
<OPTION VALUE="z3"> BMW Z3 <BR>
|
||||
<OPTION VALUE="infiniti"> InfinitiQ3 <BR>
|
||||
<OPTION VALUE="audi"> Audi A8 <BR>
|
||||
</SELECT>
|
||||
<br> <INPUT TYPE=submit name=submit Value="Submit">
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
25
tomcat/webapps.dist/examples/jsp/error/errorpge.jsp
Normal file
25
tomcat/webapps.dist/examples/jsp/error/errorpge.jsp
Normal file
@@ -0,0 +1,25 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
|
||||
<body bgcolor="red">
|
||||
|
||||
<%@ page isErrorPage="true" %>
|
||||
<h1> The exception <%= exception.getMessage() %> tells me you
|
||||
made a wrong choice.
|
||||
</body>
|
||||
</html>
|
||||
26
tomcat/webapps.dist/examples/jsp/error/errorpge.jsp.html
Normal file
26
tomcat/webapps.dist/examples/jsp/error/errorpge.jsp.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
|
||||
<body bgcolor="red">
|
||||
|
||||
<%@ page isErrorPage="true" %>
|
||||
<h1> The exception <%= exception.getMessage() %> tells me you
|
||||
made a wrong choice.
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
||||
33
tomcat/webapps.dist/examples/jsp/forward/forward.jsp
Normal file
33
tomcat/webapps.dist/examples/jsp/forward/forward.jsp
Normal file
@@ -0,0 +1,33 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
<%
|
||||
double freeMem = Runtime.getRuntime().freeMemory();
|
||||
double totlMem = Runtime.getRuntime().totalMemory();
|
||||
double percent = freeMem/totlMem;
|
||||
if (percent < 0.5) {
|
||||
%>
|
||||
|
||||
<jsp:forward page="one.jsp"/>
|
||||
|
||||
<% } else { %>
|
||||
|
||||
<jsp:forward page="two.html"/>
|
||||
|
||||
<% } %>
|
||||
|
||||
</html>
|
||||
34
tomcat/webapps.dist/examples/jsp/forward/forward.jsp.html
Normal file
34
tomcat/webapps.dist/examples/jsp/forward/forward.jsp.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
<%
|
||||
double freeMem = Runtime.getRuntime().freeMemory();
|
||||
double totlMem = Runtime.getRuntime().totalMemory();
|
||||
double percent = freeMem/totlMem;
|
||||
if (percent < 0.5) {
|
||||
%>
|
||||
|
||||
<jsp:forward page="one.jsp"/>
|
||||
|
||||
<% } else { %>
|
||||
|
||||
<jsp:forward page="two.html"/>
|
||||
|
||||
<% } %>
|
||||
|
||||
</html>
|
||||
</pre></body></html>
|
||||
30
tomcat/webapps.dist/examples/jsp/forward/fwd.html
Normal file
30
tomcat/webapps.dist/examples/jsp/forward/fwd.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>Untitled Document</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="forward.jsp"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="forward.jsp.html">Source Code for Forward Example<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
23
tomcat/webapps.dist/examples/jsp/forward/one.jsp
Normal file
23
tomcat/webapps.dist/examples/jsp/forward/one.jsp
Normal file
@@ -0,0 +1,23 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
|
||||
<body bgcolor="white">
|
||||
<font color="red">
|
||||
|
||||
VM Memory usage < 50%.
|
||||
</html>
|
||||
24
tomcat/webapps.dist/examples/jsp/forward/one.jsp.html
Normal file
24
tomcat/webapps.dist/examples/jsp/forward/one.jsp.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
|
||||
<body bgcolor="white">
|
||||
<font color="red">
|
||||
|
||||
VM Memory usage &lt; 50%.
|
||||
</html>
|
||||
</pre></body></html>
|
||||
23
tomcat/webapps.dist/examples/jsp/forward/two.html
Normal file
23
tomcat/webapps.dist/examples/jsp/forward/two.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<body bgcolor="white">
|
||||
<font color="red">
|
||||
|
||||
VM Memory usage > 50%.
|
||||
</html>
|
||||
BIN
tomcat/webapps.dist/examples/jsp/images/code.gif
Normal file
BIN
tomcat/webapps.dist/examples/jsp/images/code.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 292 B |
BIN
tomcat/webapps.dist/examples/jsp/images/execute.gif
Normal file
BIN
tomcat/webapps.dist/examples/jsp/images/execute.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
tomcat/webapps.dist/examples/jsp/images/return.gif
Normal file
BIN
tomcat/webapps.dist/examples/jsp/images/return.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
17
tomcat/webapps.dist/examples/jsp/include/foo.html
Normal file
17
tomcat/webapps.dist/examples/jsp/include/foo.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
To get the current time in ms
|
||||
17
tomcat/webapps.dist/examples/jsp/include/foo.jsp
Normal file
17
tomcat/webapps.dist/examples/jsp/include/foo.jsp
Normal file
@@ -0,0 +1,17 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
--%><%= System.currentTimeMillis() %>
|
||||
18
tomcat/webapps.dist/examples/jsp/include/foo.jsp.html
Normal file
18
tomcat/webapps.dist/examples/jsp/include/foo.jsp.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
--%><%= System.currentTimeMillis() %>
|
||||
</pre></body></html>
|
||||
30
tomcat/webapps.dist/examples/jsp/include/inc.html
Normal file
30
tomcat/webapps.dist/examples/jsp/include/inc.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>Untitled Document</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="include.jsp"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="include.jsp.html">Source Code for Include Example<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
30
tomcat/webapps.dist/examples/jsp/include/include.jsp
Normal file
30
tomcat/webapps.dist/examples/jsp/include/include.jsp
Normal file
@@ -0,0 +1,30 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
|
||||
<body bgcolor="white">
|
||||
|
||||
<font color="red">
|
||||
|
||||
<%@ page buffer="5kb" autoFlush="false" %>
|
||||
|
||||
<p>In place evaluation of another JSP which gives you the current time: <%@ include file="foo.jsp" %>
|
||||
|
||||
<p> <jsp:include page="foo.html" flush="true"/> by including the output of another JSP: <jsp:include page="foo.jsp" flush="true"/>
|
||||
:-)
|
||||
|
||||
</html>
|
||||
31
tomcat/webapps.dist/examples/jsp/include/include.jsp.html
Normal file
31
tomcat/webapps.dist/examples/jsp/include/include.jsp.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
|
||||
<body bgcolor="white">
|
||||
|
||||
<font color="red">
|
||||
|
||||
<%@ page buffer="5kb" autoFlush="false" %>
|
||||
|
||||
<p>In place evaluation of another JSP which gives you the current time: <%@ include file="foo.jsp" %>
|
||||
|
||||
<p> <jsp:include page="foo.html" flush="true"/> by including the output of another JSP: <jsp:include page="foo.jsp" flush="true"/>
|
||||
:-)
|
||||
|
||||
</html>
|
||||
</pre></body></html>
|
||||
361
tomcat/webapps.dist/examples/jsp/index.html
Normal file
361
tomcat/webapps.dist/examples/jsp/index.html
Normal file
@@ -0,0 +1,361 @@
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<!DOCTYPE html><html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="Author" content="Anil K. Vijendran" />
|
||||
<title>JSP Examples</title>
|
||||
<style type="text/css">
|
||||
img { border: 0; }
|
||||
th { text-align: left; }
|
||||
tr { vertical-align: top; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP
|
||||
Samples</h1>
|
||||
<p>This is a collection of samples demonstrating the usage of different
|
||||
parts of the Java Server Pages (JSP) specification. Both JSP 2.0 and
|
||||
JSP 1.2 examples are presented below.
|
||||
<p>These examples will only work when these pages are being served by a
|
||||
servlet engine; of course, we recommend
|
||||
<a href="https://tomcat.apache.org/">Tomcat</a>.
|
||||
They will not work if you are viewing these pages via a
|
||||
"file://..." URL.
|
||||
<p>To navigate your way through the examples, the following icons will
|
||||
help:</p>
|
||||
<ul style="list-style-type: none; padding-left: 0;">
|
||||
<li><img src="images/execute.gif" alt=""> Execute the example</li>
|
||||
<li><img src="images/code.gif" alt=""> Look at the source code for the example</li>
|
||||
<li><img src="images/return.gif" alt=""> Return to this screen</li>
|
||||
</ul>
|
||||
|
||||
<p>Tip: For session scoped beans to work, the cookies must be enabled.
|
||||
This can be done using browser options.</p>
|
||||
<h2>JSP 2.0 Examples</h2>
|
||||
|
||||
<table style="width: 85%;">
|
||||
<tr>
|
||||
<th colspan="3">Expression Language</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Basic Arithmetic</td>
|
||||
<td style="width: 30%;"><a href="jsp2/el/basic-arithmetic.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/basic-arithmetic.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/el/basic-arithmetic.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/basic-arithmetic.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Basic Comparisons</td>
|
||||
<td style="width: 30%;"><a href="jsp2/el/basic-comparisons.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/basic-comparisons.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/el/basic-comparisons.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/basic-comparisons.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Implicit Objects</td>
|
||||
<td style="width: 30%;"><a href="jsp2/el/implicit-objects.jsp?foo=bar"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/implicit-objects.jsp?foo=bar">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/el/implicit-objects.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/implicit-objects.html">Source</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<td>Functions</td>
|
||||
<td style="width: 30%;"><a href="jsp2/el/functions.jsp?foo=JSP+2.0"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/functions.jsp?foo=JSP+2.0">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/el/functions.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/functions.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Composite Expressions</td>
|
||||
<td style="width: 30%;"><a href="jsp2/el/composite.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/composite.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/el/composite.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/composite.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<th colspan="3"><br />SimpleTag Handlers and JSP Fragments</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Hello World Tag</td>
|
||||
<td style="width: 30%;"><a href="jsp2/simpletag/hello.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/simpletag/hello.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/simpletag/hello.html"><img src="images/code.gif" alt=""></a><a href="jsp2/simpletag/hello.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Repeat Tag</td>
|
||||
<td style="width: 30%;"><a href="jsp2/simpletag/repeat.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/simpletag/repeat.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/simpletag/repeat.html"><img src="images/code.gif" alt=""></a><a href="jsp2/simpletag/repeat.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Book Example</td>
|
||||
<td style="width: 30%;"><a href="jsp2/simpletag/book.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/simpletag/book.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/simpletag/book.html"><img src="images/code.gif" alt=""></a><a href="jsp2/simpletag/book.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="3"><br />Tag Files</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Hello World Tag File</td>
|
||||
<td style="width: 30%;"><a href="jsp2/tagfiles/hello.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/tagfiles/hello.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/tagfiles/hello.html"><img src="images/code.gif" alt=""></a><a href="jsp2/tagfiles/hello.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Panel Tag File</td>
|
||||
<td style="width: 30%;"><a href="jsp2/tagfiles/panel.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/tagfiles/panel.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/tagfiles/panel.html"><img src="images/code.gif" alt=""></a><a href="jsp2/tagfiles/panel.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Display Products Example</td>
|
||||
<td style="width: 30%;"><a href="jsp2/tagfiles/products.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/tagfiles/products.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/tagfiles/products.html"><img src="images/code.gif" alt=""></a><a href="jsp2/tagfiles/products.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="3"><br />New JSP XML Syntax (.jspx)</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>XHTML Basic Example</td>
|
||||
<td style="width: 30%;"><a href="jsp2/jspx/basic.jspx"><img src="images/execute.gif" alt=""></a><a href="jsp2/jspx/basic.jspx">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/jspx/basic.html"><img src="images/code.gif" alt=""></a><a href="jsp2/jspx/basic.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>SVG (Scalable Vector Graphics)</td>
|
||||
<td style="width: 30%;"><a href="jsp2/jspx/svgexample.html"><img src="images/execute.gif" alt=""></a><a href="jsp2/jspx/svgexample.html">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/jspx/textRotate.html"><img src="images/code.gif" alt=""></a><a href="jsp2/jspx/textRotate.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="3"><br />Other JSP 2.0 Features</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><jsp:attribute> and <jsp:body></td>
|
||||
<td style="width: 30%;"><a href="jsp2/jspattribute/jspattribute.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/jspattribute/jspattribute.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/jspattribute/jspattribute.html"><img src="images/code.gif" alt=""></a><a href="jsp2/jspattribute/jspattribute.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Shuffle Example</td>
|
||||
<td style="width: 30%;"><a href="jsp2/jspattribute/shuffle.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/jspattribute/shuffle.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/jspattribute/shuffle.html"><img src="images/code.gif" alt=""></a><a href="jsp2/jspattribute/shuffle.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Attributes With Dynamic Names</td>
|
||||
<td style="width: 30%;"><a href="jsp2/misc/dynamicattrs.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/misc/dynamicattrs.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/misc/dynamicattrs.html"><img src="images/code.gif" alt=""></a><a href="jsp2/misc/dynamicattrs.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>JSP Configuration</td>
|
||||
<td style="width: 30%;"><a href="jsp2/misc/config.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/misc/config.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsp2/misc/config.html"><img src="images/code.gif" alt=""></a><a href="jsp2/misc/config.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h2>JSP 1.2 Examples</h2>
|
||||
<table style="width: 85%;">
|
||||
<tr>
|
||||
<td>Numberguess</td>
|
||||
|
||||
<td style="width: 30%;"><a href="num/numguess.jsp"><img src="images/execute.gif" alt=""></a><a href="num/numguess.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="num/numguess.html"><img src="images/code.gif" alt=""></a><a href="num/numguess.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Date</td>
|
||||
|
||||
<td style="width: 30%;"><a href="dates/date.jsp"><img src="images/execute.gif" alt=""></a><a href="dates/date.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="dates/date.html"><img src="images/code.gif" alt=""></a><a href="dates/date.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Snoop</td>
|
||||
|
||||
<td style="width: 30%;"><a href="snp/snoop.jsp"><img src="images/execute.gif" alt=""></a><a href="snp/snoop.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="snp/snoop.html"><img src="images/code.gif" alt=""></a><a href="snp/snoop.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>ErrorPage</td>
|
||||
|
||||
<td style="width: 30%;"><a href="error/error.html"><img src="images/execute.gif" alt=""></a><a href="error/error.html">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="error/er.html"><img src="images/code.gif" alt=""></a><a href="error/er.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Carts</td>
|
||||
|
||||
<td style="width: 30%;"><a href="sessions/carts.html"><img src="images/execute.gif" alt=""></a><a href="sessions/carts.html">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="sessions/crt.html"><img src="images/code.gif" alt=""></a><a href="sessions/crt.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Checkbox</td>
|
||||
|
||||
<td style="width: 30%;"><a href="checkbox/check.html"><img src="images/execute.gif" alt=""></a><a href="checkbox/check.html">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="checkbox/cresult.html"><img src="images/code.gif" alt=""></a><a href="checkbox/cresult.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Color</td>
|
||||
|
||||
<td style="width: 30%;"><a href="colors/colors.html"><img src="images/execute.gif" alt=""></a><a href="colors/colors.html">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="colors/clr.html"><img src="images/code.gif" alt=""></a><a href="colors/clr.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Calendar</td>
|
||||
|
||||
<td style="width: 30%;"><a href="cal/login.html"><img src="images/execute.gif" alt=""></a><a href="cal/login.html">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="cal/calendar.html"><img src="images/code.gif" alt=""></a><a href="cal/calendar.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Include</td>
|
||||
|
||||
<td style="width: 30%;"><a href="include/include.jsp"><img src="images/execute.gif" alt=""></a><a href="include/include.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="include/inc.html"><img src="images/code.gif" alt=""></a><a href="include/inc.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Forward</td>
|
||||
|
||||
<td style="width: 30%;"><a href="forward/forward.jsp"><img src="images/execute.gif" alt=""></a><a href="forward/forward.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="forward/fwd.html"><img src="images/code.gif" alt=""></a><a href="forward/fwd.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>JSP-Servlet-JSP</td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsptoserv/jsptoservlet.jsp"><img src="images/execute.gif" alt=""></a><a href="jsptoserv/jsptoservlet.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="jsptoserv/jts.html"><img src="images/code.gif" alt=""></a><a href="jsptoserv/jts.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Custom tag example</td>
|
||||
|
||||
<td style="width: 30%;"><a href="simpletag/foo.jsp"><img src="images/execute.gif" alt=""></a><a href="simpletag/foo.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="simpletag/foo.html"><img src="images/code.gif" alt=""></a><a href="simpletag/foo.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>XML syntax example</td>
|
||||
<td style="width: 30%;"><a href="xml/xml.jsp"><img src="images/execute.gif" alt=""></a><a href="xml/xml.jsp">Execute</a></td>
|
||||
|
||||
<td style="width: 30%;"><a href="xml/xml.html"><img src="images/code.gif" alt=""></a><a href="xml/xml.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h2>Tag Plugins</h2>
|
||||
<table style="width: 85%;">
|
||||
|
||||
<tr>
|
||||
<td>If</td>
|
||||
<td style="width: 30%;">
|
||||
<a href="tagplugin/if.jsp"><img src="images/execute.gif" alt=""></a>
|
||||
<a href="tagplugin/if.jsp">Execute</a>
|
||||
</td>
|
||||
<td style="width: 30%;">
|
||||
<a href="tagplugin/if.html"><img src="images/code.gif" alt=""></a>
|
||||
<a href="tagplugin/if.html">Source</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>ForEach</td>
|
||||
<td style="width: 30%;">
|
||||
<a href="tagplugin/foreach.jsp"><img src="images/execute.gif" alt=""></a>
|
||||
<a href="tagplugin/foreach.jsp">Execute</a>
|
||||
</td>
|
||||
<td style="width: 30%;">
|
||||
<a href="tagplugin/foreach.html"><img src="images/code.gif" alt=""></a>
|
||||
<a href="tagplugin/foreach.html">Source</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Choose</td>
|
||||
<td style="width: 30%;">
|
||||
<a href="tagplugin/choose.jsp"><img src="images/execute.gif" alt=""></a>
|
||||
<a href="tagplugin/choose.jsp">Execute</a>
|
||||
</td>
|
||||
<td style="width: 30%;">
|
||||
<a href="tagplugin/choose.html"><img src="images/code.gif" alt=""></a>
|
||||
<a href="tagplugin/choose.html">Source</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h2>Other Examples</h2>
|
||||
<table style="width: 85%;">
|
||||
|
||||
<tr>
|
||||
<td>FORM Authentication</td>
|
||||
<td style="width: 30%;">
|
||||
<a href="security/protected/index.jsp"><img src="images/execute.gif" alt=""> Execute</a>
|
||||
</td>
|
||||
<td style="width: 30%;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">Example that demonstrates protecting a resource and
|
||||
using Form-Based authentication. To access the page the user must
|
||||
have role of either "tomcat" or "role1". By default no user
|
||||
is configured to have these roles.</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
46
tomcat/webapps.dist/examples/jsp/jsp2/el/Functions.java.html
Normal file
46
tomcat/webapps.dist/examples/jsp/jsp2/el/Functions.java.html
Normal file
@@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package jsp2.examples.el;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Defines the functions for the jsp2 example tag library.
|
||||
*
|
||||
* <p>Each function is defined as a static method.</p>
|
||||
*/
|
||||
public class Functions {
|
||||
public static String reverse( String text ) {
|
||||
return new StringBuilder( text ).reverse().toString();
|
||||
}
|
||||
|
||||
public static int numVowels( String text ) {
|
||||
String vowels = "aeiouAEIOU";
|
||||
int result = 0;
|
||||
for( int i = 0; i < text.length(); i++ ) {
|
||||
if( vowels.indexOf( text.charAt( i ) ) != -1 ) {
|
||||
result++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String caps( String text ) {
|
||||
return text.toUpperCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
</pre></body></html>
|
||||
@@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package jsp2.examples;
|
||||
|
||||
/**
|
||||
* Accept and display a value.
|
||||
*/
|
||||
public class ValuesBean {
|
||||
private String string;
|
||||
private double doubleValue;
|
||||
private long longValue;
|
||||
|
||||
public String getStringValue() {
|
||||
return this.string;
|
||||
}
|
||||
|
||||
public void setStringValue(String string) {
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
public double getDoubleValue() {
|
||||
return doubleValue;
|
||||
}
|
||||
|
||||
public void setDoubleValue(double doubleValue) {
|
||||
this.doubleValue = doubleValue;
|
||||
}
|
||||
|
||||
public long getLongValue() {
|
||||
return longValue;
|
||||
}
|
||||
|
||||
public void setLongValue(long longValue) {
|
||||
this.longValue = longValue;
|
||||
}
|
||||
}
|
||||
</pre></body></html>
|
||||
80
tomcat/webapps.dist/examples/jsp/jsp2/el/ValuesTag.java.html
Normal file
80
tomcat/webapps.dist/examples/jsp/jsp2/el/ValuesTag.java.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package examples;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
/**
|
||||
* Accept and display a value.
|
||||
*/
|
||||
public class ValuesTag extends TagSupport {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Using "-1" as the default value,
|
||||
// in the assumption that it won't be used as the value.
|
||||
// Cannot use null here, because null is an important case
|
||||
// that should be present in the tests.
|
||||
private Object objectValue = "-1";
|
||||
private String stringValue = "-1";
|
||||
private long longValue = -1;
|
||||
private double doubleValue = -1;
|
||||
|
||||
public void setObject(Object objectValue) {
|
||||
this.objectValue = objectValue;
|
||||
}
|
||||
|
||||
public void setString(String stringValue) {
|
||||
this.stringValue = stringValue;
|
||||
}
|
||||
|
||||
public void setLong(long longValue) {
|
||||
this.longValue = longValue;
|
||||
}
|
||||
|
||||
public void setDouble(double doubleValue) {
|
||||
this.doubleValue = doubleValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int doEndTag() throws JspException {
|
||||
JspWriter out = pageContext.getOut();
|
||||
|
||||
try {
|
||||
if (!"-1".equals(objectValue)) {
|
||||
out.print(objectValue);
|
||||
} else if (!"-1".equals(stringValue)) {
|
||||
out.print(stringValue);
|
||||
} else if (longValue != -1) {
|
||||
out.print(longValue);
|
||||
} else if (doubleValue != -1) {
|
||||
out.print(doubleValue);
|
||||
} else {
|
||||
out.print("-1");
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
throw new JspTagException("IOException: " + ex.toString(), ex);
|
||||
}
|
||||
return super.doEndTag();
|
||||
}
|
||||
}
|
||||
</pre></body></html>
|
||||
@@ -0,0 +1,30 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>View Source Code</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="basic-arithmetic.jsp"><img src="../../images/execute.gif" align="right" border="0"></a><a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="basic-arithmetic.jsp.html">Source Code for Basic Arithmetic Example<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,88 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Basic Arithmetic</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Basic Arithmetic</h1>
|
||||
<hr>
|
||||
This example illustrates basic Expression Language arithmetic.
|
||||
Addition (+), subtraction (-), multiplication (*), division (/ or div),
|
||||
and modulus (% or mod) are all supported. Error conditions, like
|
||||
division by zero, are handled gracefully.
|
||||
<br>
|
||||
<blockquote>
|
||||
<code>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td><b>EL Expression</b></td>
|
||||
<td><b>Result</b></td>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>\${1}</td>
|
||||
<td>${1}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1 + 2}</td>
|
||||
<td>${1 + 2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1.2 + 2.3}</td>
|
||||
<td>${1.2 + 2.3}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1.2E4 + 1.4}</td>
|
||||
<td>${1.2E4 + 1.4}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${-4 - 2}</td>
|
||||
<td>${-4 - 2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${21 * 2}</td>
|
||||
<td>${21 * 2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${3/4}</td>
|
||||
<td>${3/4}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${3 div 4}</td>
|
||||
<td>${3 div 4}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${3/0}</td>
|
||||
<td>${3/0}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${10%4}</td>
|
||||
<td>${10%4}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${10 mod 4}</td>
|
||||
<td>${10 mod 4}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${(1==2) ? 3 : 4}</td>
|
||||
<td>${(1==2) ? 3 : 4}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,89 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Basic Arithmetic</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Basic Arithmetic</h1>
|
||||
<hr>
|
||||
This example illustrates basic Expression Language arithmetic.
|
||||
Addition (+), subtraction (-), multiplication (*), division (/ or div),
|
||||
and modulus (% or mod) are all supported. Error conditions, like
|
||||
division by zero, are handled gracefully.
|
||||
<br>
|
||||
<blockquote>
|
||||
<code>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td><b>EL Expression</b></td>
|
||||
<td><b>Result</b></td>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>\${1}</td>
|
||||
<td>${1}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1 + 2}</td>
|
||||
<td>${1 + 2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1.2 + 2.3}</td>
|
||||
<td>${1.2 + 2.3}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1.2E4 + 1.4}</td>
|
||||
<td>${1.2E4 + 1.4}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${-4 - 2}</td>
|
||||
<td>${-4 - 2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${21 * 2}</td>
|
||||
<td>${21 * 2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${3/4}</td>
|
||||
<td>${3/4}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${3 div 4}</td>
|
||||
<td>${3 div 4}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${3/0}</td>
|
||||
<td>${3/0}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${10%4}</td>
|
||||
<td>${10%4}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${10 mod 4}</td>
|
||||
<td>${10 mod 4}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${(1==2) ? 3 : 4}</td>
|
||||
<td>${(1==2) ? 3 : 4}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
||||
@@ -0,0 +1,30 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>View Source Code</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="basic-comparisons.jsp"><img src="../../images/execute.gif" align="right" border="0"></a><a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="basic-comparisons.jsp.html">Source Code for Basic Comparisons Example<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
116
tomcat/webapps.dist/examples/jsp/jsp2/el/basic-comparisons.jsp
Normal file
116
tomcat/webapps.dist/examples/jsp/jsp2/el/basic-comparisons.jsp
Normal file
@@ -0,0 +1,116 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Basic Comparisons</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Basic Comparisons</h1>
|
||||
<hr>
|
||||
This example illustrates basic Expression Language comparisons.
|
||||
The following comparison operators are supported:
|
||||
<ul>
|
||||
<li>Less-than (< or lt)</li>
|
||||
<li>Greater-than (> or gt)</li>
|
||||
<li>Less-than-or-equal (<= or le)</li>
|
||||
<li>Greater-than-or-equal (>= or ge)</li>
|
||||
<li>Equal (== or eq)</li>
|
||||
<li>Not Equal (!= or ne)</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<u><b>Numeric</b></u>
|
||||
<code>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td><b>EL Expression</b></td>
|
||||
<td><b>Result</b></td>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>\${1 < 2}</td>
|
||||
<td>${1 < 2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1 lt 2}</td>
|
||||
<td>${1 lt 2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1 > (4/2)}</td>
|
||||
<td>${1 > (4/2)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1 gt (4/2)}</td>
|
||||
<td>${1 gt (4/2)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${4.0 >= 3}</td>
|
||||
<td>${4.0 >= 3}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${4.0 ge 3}</td>
|
||||
<td>${4.0 ge 3}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${4 <= 3}</td>
|
||||
<td>${4 <= 3}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${4 le 3}</td>
|
||||
<td>${4 le 3}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${100.0 == 100}</td>
|
||||
<td>${100.0 == 100}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${100.0 eq 100}</td>
|
||||
<td>${100.0 eq 100}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${(10*10) != 100}</td>
|
||||
<td>${(10*10) != 100}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${(10*10) ne 100}</td>
|
||||
<td>${(10*10) ne 100}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
<br>
|
||||
<u><b>Alphabetic</b></u>
|
||||
<code>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td><b>EL Expression</b></td>
|
||||
<td><b>Result</b></td>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>\${'a' < 'b'}</td>
|
||||
<td>${'a' < 'b'}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${'hip' > 'hit'}</td>
|
||||
<td>${'hip' > 'hit'}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${'4' > 3}</td>
|
||||
<td>${'4' > 3}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,117 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Basic Comparisons</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Basic Comparisons</h1>
|
||||
<hr>
|
||||
This example illustrates basic Expression Language comparisons.
|
||||
The following comparison operators are supported:
|
||||
<ul>
|
||||
<li>Less-than (&lt; or lt)</li>
|
||||
<li>Greater-than (&gt; or gt)</li>
|
||||
<li>Less-than-or-equal (&lt;= or le)</li>
|
||||
<li>Greater-than-or-equal (&gt;= or ge)</li>
|
||||
<li>Equal (== or eq)</li>
|
||||
<li>Not Equal (!= or ne)</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<u><b>Numeric</b></u>
|
||||
<code>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td><b>EL Expression</b></td>
|
||||
<td><b>Result</b></td>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>\${1 &lt; 2}</td>
|
||||
<td>${1 < 2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1 lt 2}</td>
|
||||
<td>${1 lt 2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1 &gt; (4/2)}</td>
|
||||
<td>${1 > (4/2)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1 gt (4/2)}</td>
|
||||
<td>${1 gt (4/2)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${4.0 &gt;= 3}</td>
|
||||
<td>${4.0 >= 3}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${4.0 ge 3}</td>
|
||||
<td>${4.0 ge 3}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${4 &lt;= 3}</td>
|
||||
<td>${4 <= 3}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${4 le 3}</td>
|
||||
<td>${4 le 3}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${100.0 == 100}</td>
|
||||
<td>${100.0 == 100}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${100.0 eq 100}</td>
|
||||
<td>${100.0 eq 100}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${(10*10) != 100}</td>
|
||||
<td>${(10*10) != 100}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${(10*10) ne 100}</td>
|
||||
<td>${(10*10) ne 100}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
<br>
|
||||
<u><b>Alphabetic</b></u>
|
||||
<code>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td><b>EL Expression</b></td>
|
||||
<td><b>Result</b></td>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>\${'a' &lt; 'b'}</td>
|
||||
<td>${'a' < 'b'}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${'hip' &gt; 'hit'}</td>
|
||||
<td>${'hip' > 'hit'}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${'4' &gt; 3}</td>
|
||||
<td>${'4' > 3}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
||||
31
tomcat/webapps.dist/examples/jsp/jsp2/el/composite.html
Normal file
31
tomcat/webapps.dist/examples/jsp/jsp2/el/composite.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>View Source Code</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="composite.jsp"><img src="../../images/execute.gif" align="right" border="0"></a><a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="composite.jsp.html">Source Code for composite.jsp</a></h3>
|
||||
<h3><a href="ValuesTag.java.html">Source Code for ValuesTag.java</a></h3>
|
||||
<h3><a href="ValuesBean.java.html">Source Code for ValuesBean.java</a></h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
110
tomcat/webapps.dist/examples/jsp/jsp2/el/composite.jsp
Normal file
110
tomcat/webapps.dist/examples/jsp/jsp2/el/composite.jsp
Normal file
@@ -0,0 +1,110 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@ taglib prefix="my" uri="http://tomcat.apache.org/example-taglib" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Composite Expressions</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Composite Expressions</h1>
|
||||
<hr>
|
||||
This example illustrates EL composite expressions. Composite expressions
|
||||
are formed by grouping together multiple EL expressions. Each of them is
|
||||
evaluated from left to right, coerced to String, all those strings are
|
||||
concatenated, and the result is coerced to the expected type.
|
||||
|
||||
<jsp:useBean id="values" class="jsp2.examples.ValuesBean" />
|
||||
|
||||
<blockquote>
|
||||
<code>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td><b>EL Expression</b></td>
|
||||
<td><b>Type</b></td>
|
||||
<td><b>Result</b></td>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>\${'hello'} wo\${'rld'}</td>
|
||||
<td>String</td>
|
||||
<td><jsp:setProperty name="values" property="stringValue" value="${'hello'} wo${'rld'}"/>${values.stringValue}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${'hello'} wo\${'rld'}</td>
|
||||
<td>String</td>
|
||||
<td><my:values string="${'hello'} wo${'rld'}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1+2}.\${220}</td>
|
||||
<td>Double</td>
|
||||
<td><jsp:setProperty name="values" property="doubleValue" value="${1+2}.${220}"/>${values.doubleValue}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1+2}.\${220}</td>
|
||||
<td>Double</td>
|
||||
<td><my:values double="${1+2}.${220}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>000\${1}\${7}</td>
|
||||
<td>Long</td>
|
||||
<td><jsp:setProperty name="values" property="longValue" value="000${1}${7}"/>${values.longValue}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>000\${1}\${7}</td>
|
||||
<td>Long</td>
|
||||
<td><my:values long="000${1}${7}"/></td>
|
||||
</tr>
|
||||
<!--
|
||||
Undefined values are to be coerced to String, to be "",
|
||||
https://bz.apache.org/bugzilla/show_bug.cgi?id=47413
|
||||
-->
|
||||
<tr>
|
||||
<td>\${undefinedFoo}hello world\${undefinedBar}</td>
|
||||
<td>String</td>
|
||||
<td><jsp:setProperty name="values" property="stringValue" value="${undefinedFoo}hello world${undefinedBar}"/>${values.stringValue}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${undefinedFoo}hello world\${undefinedBar}</td>
|
||||
<td>String</td>
|
||||
<td><my:values string="${undefinedFoo}hello world${undefinedBar}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${undefinedFoo}\${undefinedBar}</td>
|
||||
<td>Double</td>
|
||||
<td><jsp:setProperty name="values" property="doubleValue" value="${undefinedFoo}${undefinedBar}"/>${values.doubleValue}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${undefinedFoo}\${undefinedBar}</td>
|
||||
<td>Double</td>
|
||||
<td><my:values double="${undefinedFoo}${undefinedBar}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${undefinedFoo}\${undefinedBar}</td>
|
||||
<td>Long</td>
|
||||
<td><jsp:setProperty name="values" property="longValue" value="${undefinedFoo}${undefinedBar}"/>${values.longValue}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${undefinedFoo}\${undefinedBar}</td>
|
||||
<td>Long</td>
|
||||
<td><my:values long="${undefinedFoo}${undefinedBar}"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
111
tomcat/webapps.dist/examples/jsp/jsp2/el/composite.jsp.html
Normal file
111
tomcat/webapps.dist/examples/jsp/jsp2/el/composite.jsp.html
Normal file
@@ -0,0 +1,111 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@ taglib prefix="my" uri="http://tomcat.apache.org/example-taglib" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Composite Expressions</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Composite Expressions</h1>
|
||||
<hr>
|
||||
This example illustrates EL composite expressions. Composite expressions
|
||||
are formed by grouping together multiple EL expressions. Each of them is
|
||||
evaluated from left to right, coerced to String, all those strings are
|
||||
concatenated, and the result is coerced to the expected type.
|
||||
|
||||
<jsp:useBean id="values" class="jsp2.examples.ValuesBean" />
|
||||
|
||||
<blockquote>
|
||||
<code>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td><b>EL Expression</b></td>
|
||||
<td><b>Type</b></td>
|
||||
<td><b>Result</b></td>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>\${'hello'} wo\${'rld'}</td>
|
||||
<td>String</td>
|
||||
<td><jsp:setProperty name="values" property="stringValue" value="${'hello'} wo${'rld'}"/>${values.stringValue}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${'hello'} wo\${'rld'}</td>
|
||||
<td>String</td>
|
||||
<td><my:values string="${'hello'} wo${'rld'}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1+2}.\${220}</td>
|
||||
<td>Double</td>
|
||||
<td><jsp:setProperty name="values" property="doubleValue" value="${1+2}.${220}"/>${values.doubleValue}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${1+2}.\${220}</td>
|
||||
<td>Double</td>
|
||||
<td><my:values double="${1+2}.${220}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>000\${1}\${7}</td>
|
||||
<td>Long</td>
|
||||
<td><jsp:setProperty name="values" property="longValue" value="000${1}${7}"/>${values.longValue}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>000\${1}\${7}</td>
|
||||
<td>Long</td>
|
||||
<td><my:values long="000${1}${7}"/></td>
|
||||
</tr>
|
||||
<!--
|
||||
Undefined values are to be coerced to String, to be "",
|
||||
https://bz.apache.org/bugzilla/show_bug.cgi?id=47413
|
||||
-->
|
||||
<tr>
|
||||
<td>\${undefinedFoo}hello world\${undefinedBar}</td>
|
||||
<td>String</td>
|
||||
<td><jsp:setProperty name="values" property="stringValue" value="${undefinedFoo}hello world${undefinedBar}"/>${values.stringValue}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${undefinedFoo}hello world\${undefinedBar}</td>
|
||||
<td>String</td>
|
||||
<td><my:values string="${undefinedFoo}hello world${undefinedBar}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${undefinedFoo}\${undefinedBar}</td>
|
||||
<td>Double</td>
|
||||
<td><jsp:setProperty name="values" property="doubleValue" value="${undefinedFoo}${undefinedBar}"/>${values.doubleValue}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${undefinedFoo}\${undefinedBar}</td>
|
||||
<td>Double</td>
|
||||
<td><my:values double="${undefinedFoo}${undefinedBar}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${undefinedFoo}\${undefinedBar}</td>
|
||||
<td>Long</td>
|
||||
<td><jsp:setProperty name="values" property="longValue" value="${undefinedFoo}${undefinedBar}"/>${values.longValue}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${undefinedFoo}\${undefinedBar}</td>
|
||||
<td>Long</td>
|
||||
<td><my:values long="${undefinedFoo}${undefinedBar}"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</pre></body></html>
|
||||
32
tomcat/webapps.dist/examples/jsp/jsp2/el/functions.html
Normal file
32
tomcat/webapps.dist/examples/jsp/jsp2/el/functions.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>View Source Code</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="functions.jsp?foo=JSP+2.0"><img src="../../images/execute.gif" align="right" border="0"></a><a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="functions.jsp.html">Source Code for functions.jsp<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
<h3><a href="Functions.java.html">Source Code for Functions.java<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
67
tomcat/webapps.dist/examples/jsp/jsp2/el/functions.jsp
Normal file
67
tomcat/webapps.dist/examples/jsp/jsp2/el/functions.jsp
Normal file
@@ -0,0 +1,67 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@page contentType="text/html; charset=UTF-8" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Functions</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Functions</h1>
|
||||
<hr>
|
||||
An upgrade from the JSTL expression language, the JSP 2.0 EL also
|
||||
allows for simple function invocation. Functions are defined
|
||||
by tag libraries and are implemented by a Java programmer as
|
||||
static methods.
|
||||
|
||||
<blockquote>
|
||||
<u><b>Change Parameter</b></u>
|
||||
<form action="functions.jsp" method="GET">
|
||||
foo = <input type="text" name="foo" value="${fn:escapeXml(param["foo"])}">
|
||||
<input type="submit">
|
||||
</form>
|
||||
<br>
|
||||
<code>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td><b>EL Expression</b></td>
|
||||
<td><b>Result</b></td>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>\${param["foo"]}</td>
|
||||
<td>${fn:escapeXml(param["foo"])} </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${my:reverse(param["foo"])}</td>
|
||||
<td>${my:reverse(fn:escapeXml(param["foo"]))} </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${my:reverse(my:reverse(param["foo"]))}</td>
|
||||
<td>${my:reverse(my:reverse(fn:escapeXml(param["foo"])))} </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${my:countVowels(param["foo"])}</td>
|
||||
<td>${my:countVowels(fn:escapeXml(param["foo"]))} </td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
68
tomcat/webapps.dist/examples/jsp/jsp2/el/functions.jsp.html
Normal file
68
tomcat/webapps.dist/examples/jsp/jsp2/el/functions.jsp.html
Normal file
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@page contentType="text/html; charset=UTF-8" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Functions</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Functions</h1>
|
||||
<hr>
|
||||
An upgrade from the JSTL expression language, the JSP 2.0 EL also
|
||||
allows for simple function invocation. Functions are defined
|
||||
by tag libraries and are implemented by a Java programmer as
|
||||
static methods.
|
||||
|
||||
<blockquote>
|
||||
<u><b>Change Parameter</b></u>
|
||||
<form action="functions.jsp" method="GET">
|
||||
foo = <input type="text" name="foo" value="${fn:escapeXml(param["foo"])}">
|
||||
<input type="submit">
|
||||
</form>
|
||||
<br>
|
||||
<code>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td><b>EL Expression</b></td>
|
||||
<td><b>Result</b></td>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>\${param["foo"]}</td>
|
||||
<td>${fn:escapeXml(param["foo"])}&nbsp;</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${my:reverse(param["foo"])}</td>
|
||||
<td>${my:reverse(fn:escapeXml(param["foo"]))}&nbsp;</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${my:reverse(my:reverse(param["foo"]))}</td>
|
||||
<td>${my:reverse(my:reverse(fn:escapeXml(param["foo"])))}&nbsp;</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${my:countVowels(param["foo"])}</td>
|
||||
<td>${my:countVowels(fn:escapeXml(param["foo"]))}&nbsp;</td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</pre></body></html>
|
||||
@@ -0,0 +1,31 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>View Source Code</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="implicit-objects.jsp?foo=bar"><img src="../../images/execute.gif" align="right" border="0"></a><a href="../../index.html">
|
||||
<img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="implicit-objects.jsp.html">Source Code for Implicit Objects Example<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,90 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@page contentType="text/html; charset=UTF-8" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Implicit Objects</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Implicit Objects</h1>
|
||||
<hr>
|
||||
This example illustrates some of the implicit objects available
|
||||
in the Expression Language. The following implicit objects are
|
||||
available (not all illustrated here):
|
||||
<ul>
|
||||
<li>pageContext - the PageContext object</li>
|
||||
<li>pageScope - a Map that maps page-scoped attribute names to
|
||||
their values</li>
|
||||
<li>requestScope - a Map that maps request-scoped attribute names
|
||||
to their values</li>
|
||||
<li>sessionScope - a Map that maps session-scoped attribute names
|
||||
to their values</li>
|
||||
<li>applicationScope - a Map that maps application-scoped attribute
|
||||
names to their values</li>
|
||||
<li>param - a Map that maps parameter names to a single String
|
||||
parameter value</li>
|
||||
<li>paramValues - a Map that maps parameter names to a String[] of
|
||||
all values for that parameter</li>
|
||||
<li>header - a Map that maps header names to a single String
|
||||
header value</li>
|
||||
<li>headerValues - a Map that maps header names to a String[] of
|
||||
all values for that header</li>
|
||||
<li>initParam - a Map that maps context initialization parameter
|
||||
names to their String parameter value</li>
|
||||
<li>cookie - a Map that maps cookie names to a single Cookie object.</li>
|
||||
</ul>
|
||||
|
||||
<blockquote>
|
||||
<u><b>Change Parameter</b></u>
|
||||
<form action="implicit-objects.jsp" method="GET">
|
||||
foo = <input type="text" name="foo" value="${fn:escapeXml(param["foo"])}">
|
||||
<input type="submit">
|
||||
</form>
|
||||
<br>
|
||||
<code>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td><b>EL Expression</b></td>
|
||||
<td><b>Result</b></td>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>\${param.foo}</td>
|
||||
<td>${fn:escapeXml(param["foo"])} </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${param["foo"]}</td>
|
||||
<td>${fn:escapeXml(param["foo"])} </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${header["host"]}</td>
|
||||
<td>${fn:escapeXml(header["host"])} </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${header["accept"]}</td>
|
||||
<td>${fn:escapeXml(header["accept"])} </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${header["user-agent"]}</td>
|
||||
<td>${fn:escapeXml(header["user-agent"])} </td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,91 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@page contentType="text/html; charset=UTF-8" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Expression Language - Implicit Objects</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Expression Language - Implicit Objects</h1>
|
||||
<hr>
|
||||
This example illustrates some of the implicit objects available
|
||||
in the Expression Language. The following implicit objects are
|
||||
available (not all illustrated here):
|
||||
<ul>
|
||||
<li>pageContext - the PageContext object</li>
|
||||
<li>pageScope - a Map that maps page-scoped attribute names to
|
||||
their values</li>
|
||||
<li>requestScope - a Map that maps request-scoped attribute names
|
||||
to their values</li>
|
||||
<li>sessionScope - a Map that maps session-scoped attribute names
|
||||
to their values</li>
|
||||
<li>applicationScope - a Map that maps application-scoped attribute
|
||||
names to their values</li>
|
||||
<li>param - a Map that maps parameter names to a single String
|
||||
parameter value</li>
|
||||
<li>paramValues - a Map that maps parameter names to a String[] of
|
||||
all values for that parameter</li>
|
||||
<li>header - a Map that maps header names to a single String
|
||||
header value</li>
|
||||
<li>headerValues - a Map that maps header names to a String[] of
|
||||
all values for that header</li>
|
||||
<li>initParam - a Map that maps context initialization parameter
|
||||
names to their String parameter value</li>
|
||||
<li>cookie - a Map that maps cookie names to a single Cookie object.</li>
|
||||
</ul>
|
||||
|
||||
<blockquote>
|
||||
<u><b>Change Parameter</b></u>
|
||||
<form action="implicit-objects.jsp" method="GET">
|
||||
foo = <input type="text" name="foo" value="${fn:escapeXml(param["foo"])}">
|
||||
<input type="submit">
|
||||
</form>
|
||||
<br>
|
||||
<code>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td><b>EL Expression</b></td>
|
||||
<td><b>Result</b></td>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>\${param.foo}</td>
|
||||
<td>${fn:escapeXml(param["foo"])}&nbsp;</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${param["foo"]}</td>
|
||||
<td>${fn:escapeXml(param["foo"])}&nbsp;</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${header["host"]}</td>
|
||||
<td>${fn:escapeXml(header["host"])}&nbsp;</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${header["accept"]}</td>
|
||||
<td>${fn:escapeXml(header["accept"])}&nbsp;</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\${header["user-agent"]}</td>
|
||||
<td>${fn:escapeXml(header["user-agent"])}&nbsp;</td>
|
||||
</tr>
|
||||
</table>
|
||||
</code>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
||||
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package jsp2.examples;
|
||||
|
||||
public class FooBean {
|
||||
private String bar;
|
||||
|
||||
public FooBean() {
|
||||
bar = "Initial value";
|
||||
}
|
||||
|
||||
public String getBar() {
|
||||
return this.bar;
|
||||
}
|
||||
|
||||
public void setBar(String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
}
|
||||
</pre></body></html>
|
||||
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package jsp2.examples.simpletag;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.tagext.SimpleTagSupport;
|
||||
|
||||
/**
|
||||
* SimpleTag handler that prints "Hello, world!"
|
||||
*/
|
||||
public class HelloWorldSimpleTag extends SimpleTagSupport {
|
||||
@Override
|
||||
public void doTag() throws JspException, IOException {
|
||||
getJspContext().getOut().write( "Hello, world!" );
|
||||
}
|
||||
}
|
||||
</pre></body></html>
|
||||
@@ -0,0 +1,86 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package jsp2.examples.simpletag;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.tagext.JspFragment;
|
||||
import javax.servlet.jsp.tagext.SimpleTagSupport;
|
||||
|
||||
/**
|
||||
* SimpleTag handler that accepts takes three attributes of type
|
||||
* JspFragment and invokes then in a random order.
|
||||
*/
|
||||
public class ShuffleSimpleTag extends SimpleTagSupport {
|
||||
// No need for this to use SecureRandom
|
||||
private static final Random random = new Random();
|
||||
|
||||
private JspFragment fragment1;
|
||||
private JspFragment fragment2;
|
||||
private JspFragment fragment3;
|
||||
|
||||
@Override
|
||||
public void doTag() throws JspException, IOException {
|
||||
switch(random.nextInt(6)) {
|
||||
case 0:
|
||||
fragment1.invoke( null );
|
||||
fragment2.invoke( null );
|
||||
fragment3.invoke( null );
|
||||
break;
|
||||
case 1:
|
||||
fragment1.invoke( null );
|
||||
fragment3.invoke( null );
|
||||
fragment2.invoke( null );
|
||||
break;
|
||||
case 2:
|
||||
fragment2.invoke( null );
|
||||
fragment1.invoke( null );
|
||||
fragment3.invoke( null );
|
||||
break;
|
||||
case 3:
|
||||
fragment2.invoke( null );
|
||||
fragment3.invoke( null );
|
||||
fragment1.invoke( null );
|
||||
break;
|
||||
case 4:
|
||||
fragment3.invoke( null );
|
||||
fragment1.invoke( null );
|
||||
fragment2.invoke( null );
|
||||
break;
|
||||
case 5:
|
||||
fragment3.invoke( null );
|
||||
fragment2.invoke( null );
|
||||
fragment1.invoke( null );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFragment1( JspFragment fragment1 ) {
|
||||
this.fragment1 = fragment1;
|
||||
}
|
||||
|
||||
public void setFragment2( JspFragment fragment2 ) {
|
||||
this.fragment2 = fragment2;
|
||||
}
|
||||
|
||||
public void setFragment3( JspFragment fragment3 ) {
|
||||
this.fragment3 = fragment3;
|
||||
}
|
||||
}
|
||||
</pre></body></html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package jsp2.examples.simpletag;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.tagext.SimpleTagSupport;
|
||||
|
||||
/**
|
||||
* Displays a tile as a single cell in a table.
|
||||
*/
|
||||
public class TileSimpleTag extends SimpleTagSupport {
|
||||
private String color;
|
||||
private String label;
|
||||
|
||||
@Override
|
||||
public void doTag() throws JspException, IOException {
|
||||
getJspContext().getOut().write(
|
||||
"<td width=\"32\" height=\"32\" bgcolor=\"" + this.color +
|
||||
"\"><font color=\"#ffffff\"><center>" + this.label +
|
||||
"</center></font></td>" );
|
||||
}
|
||||
|
||||
public void setColor( String color ) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void setLabel( String label ) {
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
</pre></body></html>
|
||||
@@ -0,0 +1,37 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>View Source Code</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="jspattribute.jsp"><img src="../../images/execute.gif" align="right" border="0"></a>
|
||||
<a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="jspattribute.jsp.html">Source Code for jspattribute.jsp<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
<h3><a href="HelloWorldSimpleTag.java.html">Source Code for HelloWorldSimpleTag.java<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
<h3><a href="FooBean.java.html">Source Code for FooBean.java<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,46 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Examples - jsp:attribute and jsp:body</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Examples - jsp:attribute and jsp:body</h1>
|
||||
<hr>
|
||||
<p>The new <jsp:attribute> and <jsp:body>
|
||||
standard actions can be used to specify the value of any standard
|
||||
action or custom action attribute.</p>
|
||||
<p>This example uses the <jsp:attribute>
|
||||
standard action to use the output of a custom action invocation
|
||||
(one that simply outputs "Hello, World!") to set the value of a
|
||||
bean property. This would normally require an intermediary
|
||||
step, such as using JSTL's <c:set> action.</p>
|
||||
<br>
|
||||
<jsp:useBean id="foo" class="jsp2.examples.FooBean">
|
||||
Bean created! Setting foo.bar...<br>
|
||||
<jsp:setProperty name="foo" property="bar">
|
||||
<jsp:attribute name="value">
|
||||
<my:helloWorld/>
|
||||
</jsp:attribute>
|
||||
</jsp:setProperty>
|
||||
</jsp:useBean>
|
||||
<br>
|
||||
Result: ${foo.bar}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Examples - jsp:attribute and jsp:body</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Examples - jsp:attribute and jsp:body</h1>
|
||||
<hr>
|
||||
<p>The new &lt;jsp:attribute&gt; and &lt;jsp:body&gt;
|
||||
standard actions can be used to specify the value of any standard
|
||||
action or custom action attribute.</p>
|
||||
<p>This example uses the &lt;jsp:attribute&gt;
|
||||
standard action to use the output of a custom action invocation
|
||||
(one that simply outputs "Hello, World!") to set the value of a
|
||||
bean property. This would normally require an intermediary
|
||||
step, such as using JSTL's &lt;c:set&gt; action.</p>
|
||||
<br>
|
||||
<jsp:useBean id="foo" class="jsp2.examples.FooBean">
|
||||
Bean created! Setting foo.bar...<br>
|
||||
<jsp:setProperty name="foo" property="bar">
|
||||
<jsp:attribute name="value">
|
||||
<my:helloWorld/>
|
||||
</jsp:attribute>
|
||||
</jsp:setProperty>
|
||||
</jsp:useBean>
|
||||
<br>
|
||||
Result: ${foo.bar}
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
||||
@@ -0,0 +1,37 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>View Source Code</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="shuffle.jsp"><img src="../../images/execute.gif" align="right" border="0"></a>
|
||||
<a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="shuffle.jsp.html">Source Code for shuffle.jsp<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
<h3><a href="ShuffleSimpleTag.java.html">Source Code for ShuffleSimpleTag.java<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
<h3><a href="TileSimpleTag.java.html">Source Code for TileSimpleTag.java<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,90 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Examples - Shuffle Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Examples - Shuffle Example</h1>
|
||||
<hr>
|
||||
<p>Try reloading the page a few times. Both the rows and the columns
|
||||
are shuffled and appear different each time.</p>
|
||||
<p>Here's how the code works. The SimpleTag handler called
|
||||
<my:shuffle> accepts three attributes. Each attribute is a
|
||||
JSP Fragment, meaning it is a fragment of JSP code that can be
|
||||
dynamically executed by the shuffle tag handler on demand. The
|
||||
shuffle tag handler executes the three fragments in a random order.
|
||||
To shuffle both the rows and the columns, the shuffle tag is used
|
||||
with itself as a parameter.</p>
|
||||
<hr>
|
||||
<blockquote>
|
||||
<font color="#ffffff">
|
||||
<table>
|
||||
<my:shuffle>
|
||||
<jsp:attribute name="fragment1">
|
||||
<tr>
|
||||
<my:shuffle>
|
||||
<jsp:attribute name="fragment1">
|
||||
<my:tile color="#ff0000" label="A"/>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment2">
|
||||
<my:tile color="#00ff00" label="B"/>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment3">
|
||||
<my:tile color="#0000ff" label="C"/>
|
||||
</jsp:attribute>
|
||||
</my:shuffle>
|
||||
</tr>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment2">
|
||||
<tr>
|
||||
<my:shuffle>
|
||||
<jsp:attribute name="fragment1">
|
||||
<my:tile color="#ff0000" label="1"/>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment2">
|
||||
<my:tile color="#00ff00" label="2"/>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment3">
|
||||
<my:tile color="#0000ff" label="3"/>
|
||||
</jsp:attribute>
|
||||
</my:shuffle>
|
||||
</tr>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment3">
|
||||
<tr>
|
||||
<my:shuffle>
|
||||
<jsp:attribute name="fragment1">
|
||||
<my:tile color="#ff0000" label="!"/>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment2">
|
||||
<my:tile color="#00ff00" label="@"/>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment3">
|
||||
<my:tile color="#0000ff" label="#"/>
|
||||
</jsp:attribute>
|
||||
</my:shuffle>
|
||||
</tr>
|
||||
</jsp:attribute>
|
||||
</my:shuffle>
|
||||
</table>
|
||||
</font>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,91 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Examples - Shuffle Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Examples - Shuffle Example</h1>
|
||||
<hr>
|
||||
<p>Try reloading the page a few times. Both the rows and the columns
|
||||
are shuffled and appear different each time.</p>
|
||||
<p>Here's how the code works. The SimpleTag handler called
|
||||
&lt;my:shuffle&gt; accepts three attributes. Each attribute is a
|
||||
JSP Fragment, meaning it is a fragment of JSP code that can be
|
||||
dynamically executed by the shuffle tag handler on demand. The
|
||||
shuffle tag handler executes the three fragments in a random order.
|
||||
To shuffle both the rows and the columns, the shuffle tag is used
|
||||
with itself as a parameter.</p>
|
||||
<hr>
|
||||
<blockquote>
|
||||
<font color="#ffffff">
|
||||
<table>
|
||||
<my:shuffle>
|
||||
<jsp:attribute name="fragment1">
|
||||
<tr>
|
||||
<my:shuffle>
|
||||
<jsp:attribute name="fragment1">
|
||||
<my:tile color="#ff0000" label="A"/>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment2">
|
||||
<my:tile color="#00ff00" label="B"/>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment3">
|
||||
<my:tile color="#0000ff" label="C"/>
|
||||
</jsp:attribute>
|
||||
</my:shuffle>
|
||||
</tr>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment2">
|
||||
<tr>
|
||||
<my:shuffle>
|
||||
<jsp:attribute name="fragment1">
|
||||
<my:tile color="#ff0000" label="1"/>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment2">
|
||||
<my:tile color="#00ff00" label="2"/>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment3">
|
||||
<my:tile color="#0000ff" label="3"/>
|
||||
</jsp:attribute>
|
||||
</my:shuffle>
|
||||
</tr>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment3">
|
||||
<tr>
|
||||
<my:shuffle>
|
||||
<jsp:attribute name="fragment1">
|
||||
<my:tile color="#ff0000" label="!"/>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment2">
|
||||
<my:tile color="#00ff00" label="@"/>
|
||||
</jsp:attribute>
|
||||
<jsp:attribute name="fragment3">
|
||||
<my:tile color="#0000ff" label="#"/>
|
||||
</jsp:attribute>
|
||||
</my:shuffle>
|
||||
</tr>
|
||||
</jsp:attribute>
|
||||
</my:shuffle>
|
||||
</table>
|
||||
</font>
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
||||
31
tomcat/webapps.dist/examples/jsp/jsp2/jspx/basic.html
Normal file
31
tomcat/webapps.dist/examples/jsp/jsp2/jspx/basic.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>View Source Code</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p><a href="basic.jspx"><img src="../../images/execute.gif" alt="Execute" style="border: 0;"></a><a
|
||||
href="../../index.html"><img src="../../images/return.gif" alt="Return" style="border: 0;"></a></p>
|
||||
|
||||
<h3><a href="basic.jspx.html">Source Code for XHTML Basic Example</a></h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
48
tomcat/webapps.dist/examples/jsp/jsp2/jspx/basic.jspx
Normal file
48
tomcat/webapps.dist/examples/jsp/jsp2/jspx/basic.jspx
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<html xmlns:jsp="http://java.sun.com/JSP/Page"
|
||||
xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
|
||||
xmlns="http://www.w3.org/1999/xhtml">
|
||||
<jsp:output doctype-root-element="html"
|
||||
doctype-public="-//W3C//DTD XHTML Basic 1.0//EN"
|
||||
doctype-system="http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"/>
|
||||
<jsp:directive.page contentType="application/xhtml+xml" />
|
||||
<head>
|
||||
<title>JSPX - XHTML Basic Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSPX - XHTML Basic Example</h1>
|
||||
This example illustrates how to use JSPX to produce an XHTML basic
|
||||
document suitable for use with mobile phones, televisions,
|
||||
PDAs, vending machines, pagers, car navigation systems,
|
||||
mobile game machines, digital book readers, smart watches, etc.
|
||||
<p/>
|
||||
JSPX lets you create dynamic documents in a pure XML syntax compatible
|
||||
with existing XML tools. The XML syntax in JSP 1.2 was awkward and
|
||||
required &lt;jsp:root&gt; to be the root element of the document.
|
||||
This is no longer the case in JSP 2.0.
|
||||
<p/>
|
||||
This particular example uses
|
||||
namespace declarations to make the output of this page a valid XHTML
|
||||
document.
|
||||
<p/>
|
||||
Just to prove this is live, here's some dynamic content:
|
||||
<jsp:useBean id="now" class="java.util.Date" />
|
||||
<fmt:formatDate value="${now}" pattern="MMMM d, yyyy, H:mm:ss"/>
|
||||
</body>
|
||||
</html>
|
||||
49
tomcat/webapps.dist/examples/jsp/jsp2/jspx/basic.jspx.html
Normal file
49
tomcat/webapps.dist/examples/jsp/jsp2/jspx/basic.jspx.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<html xmlns:jsp="http://java.sun.com/JSP/Page"
|
||||
xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
|
||||
xmlns="http://www.w3.org/1999/xhtml">
|
||||
<jsp:output doctype-root-element="html"
|
||||
doctype-public="-//W3C//DTD XHTML Basic 1.0//EN"
|
||||
doctype-system="http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"/>
|
||||
<jsp:directive.page contentType="application/xhtml+xml" />
|
||||
<head>
|
||||
<title>JSPX - XHTML Basic Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSPX - XHTML Basic Example</h1>
|
||||
This example illustrates how to use JSPX to produce an XHTML basic
|
||||
document suitable for use with mobile phones, televisions,
|
||||
PDAs, vending machines, pagers, car navigation systems,
|
||||
mobile game machines, digital book readers, smart watches, etc.
|
||||
<p/>
|
||||
JSPX lets you create dynamic documents in a pure XML syntax compatible
|
||||
with existing XML tools. The XML syntax in JSP 1.2 was awkward and
|
||||
required &amp;lt;jsp:root&amp;gt; to be the root element of the document.
|
||||
This is no longer the case in JSP 2.0.
|
||||
<p/>
|
||||
This particular example uses
|
||||
namespace declarations to make the output of this page a valid XHTML
|
||||
document.
|
||||
<p/>
|
||||
Just to prove this is live, here's some dynamic content:
|
||||
<jsp:useBean id="now" class="java.util.Date" />
|
||||
<fmt:formatDate value="${now}" pattern="MMMM d, yyyy, H:mm:ss"/>
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
||||
46
tomcat/webapps.dist/examples/jsp/jsp2/jspx/svgexample.html
Normal file
46
tomcat/webapps.dist/examples/jsp/jsp2/jspx/svgexample.html
Normal file
@@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html><!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>JSP 2.0 SVG Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 SVG Example</h1>
|
||||
This example uses JSP 2.0's new, simplified JSPX syntax to render a
|
||||
Scalable Vector Graphics (SVG) document. When you view the source,
|
||||
notice the lack of a <jsp:root> element! The text to be rendered
|
||||
can be modified by changing the value of the name parameter.
|
||||
<p>
|
||||
SVG has many potential uses, such as searchable images, or images
|
||||
customized with the name of your site's visitor (e.g. a "Susan's Store"
|
||||
tab image). JSPX is a natural fit for generating dynamic XML content
|
||||
such as SVG.
|
||||
<p>
|
||||
To execute this example you will need a browser with basic SVG support. Any
|
||||
remotely recent browser should have this.
|
||||
<ol>
|
||||
<li>Use this URL:
|
||||
<a href="textRotate.jspx?name=JSPX">textRotate.jspx?name=JSPX</a></li>
|
||||
<li>Customize by changing the name=JSPX parameter</li>
|
||||
</ol>
|
||||
<p style="margin-top: 2em;">
|
||||
The following is a screenshot of the resulting image, for those using a
|
||||
browser without SVG support:<br>
|
||||
<img src="textRotate.jpg" alt="[Screenshot image]" style="border: 1px solid #000;">
|
||||
</body>
|
||||
</html>
|
||||
32
tomcat/webapps.dist/examples/jsp/jsp2/jspx/textRotate.html
Normal file
32
tomcat/webapps.dist/examples/jsp/jsp2/jspx/textRotate.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>View Source Code</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p><a href="textRotate.jspx"><img src="../../images/execute.gif" alt="Execute" style="border: 0;"></a> <a
|
||||
href="../../index.html"><img src="../../images/return.gif" alt="Return" style="border: 0;"></a></p>
|
||||
|
||||
<h3><a href="textRotate.jspx.html">Source Code for SVG (Scalable Vector Graphics)
|
||||
Example</a></h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
BIN
tomcat/webapps.dist/examples/jsp/jsp2/jspx/textRotate.jpg
Normal file
BIN
tomcat/webapps.dist/examples/jsp/jsp2/jspx/textRotate.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
53
tomcat/webapps.dist/examples/jsp/jsp2/jspx/textRotate.jspx
Normal file
53
tomcat/webapps.dist/examples/jsp/jsp2/jspx/textRotate.jspx
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<!--
|
||||
- This example is based off the textRotate.svg example that comes
|
||||
- with Apache Batik. The original example was written by Bill Haneman.
|
||||
- This version by Mark Roth.
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
width="450" height="500" viewBox="0 0 450 500"
|
||||
xmlns:c="http://java.sun.com/jsp/jstl/core"
|
||||
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
|
||||
xmlns:jsp="http://java.sun.com/JSP/Page">
|
||||
<jsp:directive.page contentType="image/svg+xml" />
|
||||
<title>JSP 2.0 JSPX</title>
|
||||
<!-- select name parameter, or default to JSPX -->
|
||||
<c:set var="name" value='${empty fn:escapeXml(param["name"]) ? "JSPX" : fn:escapeXml(param["name"])}'/>
|
||||
<g id="testContent">
|
||||
<text class="title" x="50%" y="10%" font-size="15" text-anchor="middle" >
|
||||
JSP 2.0 XML Syntax (.jspx) Demo</text>
|
||||
<text class="title" x="50%" y="15%" font-size="15" text-anchor="middle" >
|
||||
Try changing the name parameter!</text>
|
||||
<g opacity="1.0" transform="translate(225, 250)" id="rotatedText">
|
||||
<c:forEach var="i" begin="1" end="24">
|
||||
<jsp:text>
|
||||
<![CDATA[<g opacity="0.95" transform="scale(1.05) rotate(15)">]]>
|
||||
</jsp:text>
|
||||
<text x="0" y="0" transform="scale(1.6, 1.6)" fill="DarkSlateBlue"
|
||||
text-anchor="middle" font-size="40" font-family="Serif"
|
||||
id="words">${name}</text>
|
||||
</c:forEach>
|
||||
<c:forEach var="i" begin="1" end="24">
|
||||
<jsp:text><![CDATA[</g>]]></jsp:text>
|
||||
</c:forEach>
|
||||
<text style="font-size:75;font-family:Serif;fill:white"
|
||||
text-anchor="middle">${name}</text>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,54 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<!--
|
||||
- This example is based off the textRotate.svg example that comes
|
||||
- with Apache Batik. The original example was written by Bill Haneman.
|
||||
- This version by Mark Roth.
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
width="450" height="500" viewBox="0 0 450 500"
|
||||
xmlns:c="http://java.sun.com/jsp/jstl/core"
|
||||
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
|
||||
xmlns:jsp="http://java.sun.com/JSP/Page">
|
||||
<jsp:directive.page contentType="image/svg+xml" />
|
||||
<title>JSP 2.0 JSPX</title>
|
||||
<!-- select name parameter, or default to JSPX -->
|
||||
<c:set var="name" value='${empty fn:escapeXml(param["name"]) ? "JSPX" : fn:escapeXml(param["name"])}'/>
|
||||
<g id="testContent">
|
||||
<text class="title" x="50%" y="10%" font-size="15" text-anchor="middle" >
|
||||
JSP 2.0 XML Syntax (.jspx) Demo</text>
|
||||
<text class="title" x="50%" y="15%" font-size="15" text-anchor="middle" >
|
||||
Try changing the name parameter!</text>
|
||||
<g opacity="1.0" transform="translate(225, 250)" id="rotatedText">
|
||||
<c:forEach var="i" begin="1" end="24">
|
||||
<jsp:text>
|
||||
<![CDATA[<g opacity="0.95" transform="scale(1.05) rotate(15)">]]>
|
||||
</jsp:text>
|
||||
<text x="0" y="0" transform="scale(1.6, 1.6)" fill="DarkSlateBlue"
|
||||
text-anchor="middle" font-size="40" font-family="Serif"
|
||||
id="words">${name}</text>
|
||||
</c:forEach>
|
||||
<c:forEach var="i" begin="1" end="24">
|
||||
<jsp:text><![CDATA[</g>]]></jsp:text>
|
||||
</c:forEach>
|
||||
<text style="font-size:75;font-family:Serif;fill:white"
|
||||
text-anchor="middle">${name}</text>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</pre></body></html>
|
||||
@@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package jsp2.examples.simpletag;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.tagext.DynamicAttributes;
|
||||
import javax.servlet.jsp.tagext.SimpleTagSupport;
|
||||
|
||||
/**
|
||||
* SimpleTag handler that echoes all its attributes
|
||||
*/
|
||||
public class EchoAttributesTag
|
||||
extends SimpleTagSupport
|
||||
implements DynamicAttributes
|
||||
{
|
||||
private final List<String> keys = new ArrayList<>();
|
||||
private final List<Object> values = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void doTag() throws JspException, IOException {
|
||||
JspWriter out = getJspContext().getOut();
|
||||
for( int i = 0; i < keys.size(); i++ ) {
|
||||
String key = keys.get( i );
|
||||
Object value = values.get( i );
|
||||
out.println( "<li>" + key + " = " + value + "</li>" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDynamicAttribute( String uri, String localName,
|
||||
Object value )
|
||||
throws JspException
|
||||
{
|
||||
keys.add( localName );
|
||||
values.add( value );
|
||||
}
|
||||
}
|
||||
</pre></body></html>
|
||||
21
tomcat/webapps.dist/examples/jsp/jsp2/misc/coda.jspf
Normal file
21
tomcat/webapps.dist/examples/jsp/jsp2/misc/coda.jspf
Normal file
@@ -0,0 +1,21 @@
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<hr>
|
||||
<center>
|
||||
This banner included with <include-coda>
|
||||
</center>
|
||||
<hr>
|
||||
22
tomcat/webapps.dist/examples/jsp/jsp2/misc/coda.jspf.html
Normal file
22
tomcat/webapps.dist/examples/jsp/jsp2/misc/coda.jspf.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<hr>
|
||||
<center>
|
||||
This banner included with &lt;include-coda&gt;
|
||||
</center>
|
||||
<hr>
|
||||
</pre></body></html>
|
||||
35
tomcat/webapps.dist/examples/jsp/jsp2/misc/config.html
Normal file
35
tomcat/webapps.dist/examples/jsp/jsp2/misc/config.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>View Source Code</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="config.jsp"><img src="../../images/execute.gif" align="right" border="0"></a>
|
||||
<a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="config.jsp.html">Source Code for config.jsp<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
<h3><a href="prelude.jspf.html">Source Code for prelude.jspf<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
<h3><a href="coda.jspf.html">Source Code for coda.jspf<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
32
tomcat/webapps.dist/examples/jsp/jsp2/misc/config.jsp
Normal file
32
tomcat/webapps.dist/examples/jsp/jsp2/misc/config.jsp
Normal file
@@ -0,0 +1,32 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
|
||||
<h1>JSP 2.0 Examples - JSP Configuration</h1>
|
||||
<hr>
|
||||
<p>Using a <jsp-property-group> element in the web.xml
|
||||
deployment descriptor, this JSP page has been configured in the
|
||||
following ways:</p>
|
||||
<ul>
|
||||
<li>Uses <include-prelude> to include the top banner.</li>
|
||||
<li>Uses <include-coda> to include the bottom banner.</li>
|
||||
<li>Uses <scripting-invalid> true to disable
|
||||
<% scripting %> elements</li>
|
||||
<li>Uses <el-ignored> true to disable ${EL} elements</li>
|
||||
<li>Uses <page-encoding> ISO-8859-1 to set the page encoding (though this is the default anyway)</li>
|
||||
</ul>
|
||||
There are various other configuration options that can be used.
|
||||
|
||||
33
tomcat/webapps.dist/examples/jsp/jsp2/misc/config.jsp.html
Normal file
33
tomcat/webapps.dist/examples/jsp/jsp2/misc/config.jsp.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
|
||||
<h1>JSP 2.0 Examples - JSP Configuration</h1>
|
||||
<hr>
|
||||
<p>Using a &lt;jsp-property-group&gt; element in the web.xml
|
||||
deployment descriptor, this JSP page has been configured in the
|
||||
following ways:</p>
|
||||
<ul>
|
||||
<li>Uses &lt;include-prelude&gt; to include the top banner.</li>
|
||||
<li>Uses &lt;include-coda&gt; to include the bottom banner.</li>
|
||||
<li>Uses &lt;scripting-invalid&gt; true to disable
|
||||
&lt;% scripting %&gt; elements</li>
|
||||
<li>Uses &lt;el-ignored&gt; true to disable ${EL} elements</li>
|
||||
<li>Uses &lt;page-encoding&gt; ISO-8859-1 to set the page encoding (though this is the default anyway)</li>
|
||||
</ul>
|
||||
There are various other configuration options that can be used.
|
||||
|
||||
</pre></body></html>
|
||||
33
tomcat/webapps.dist/examples/jsp/jsp2/misc/dynamicattrs.html
Normal file
33
tomcat/webapps.dist/examples/jsp/jsp2/misc/dynamicattrs.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<head>
|
||||
<title>View Source Code</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
<p><font color="#0000FF"><a href="dynamicattrs.jsp"><img src="../../images/execute.gif" align="right" border="0"></a>
|
||||
<a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
|
||||
|
||||
<h3><a href="dynamicattrs.jsp.html">Source Code for dynamicattrs.jsp<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
<h3><a href="EchoAttributesTag.java.html">Source Code for EchoAttributesTag.java<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
44
tomcat/webapps.dist/examples/jsp/jsp2/misc/dynamicattrs.jsp
Normal file
44
tomcat/webapps.dist/examples/jsp/jsp2/misc/dynamicattrs.jsp
Normal file
@@ -0,0 +1,44 @@
|
||||
<%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Examples - Dynamic Attributes</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Examples - Dynamic Attributes</h1>
|
||||
<hr>
|
||||
<p>This JSP page invokes a custom tag that accepts a dynamic set
|
||||
of attributes. The tag echoes the name and value of all attributes
|
||||
passed to it.</p>
|
||||
<hr>
|
||||
<h2>Invocation 1 (six attributes)</h2>
|
||||
<ul>
|
||||
<my:echoAttributes x="1" y="2" z="3" r="red" g="green" b="blue"/>
|
||||
</ul>
|
||||
<h2>Invocation 2 (zero attributes)</h2>
|
||||
<ul>
|
||||
<my:echoAttributes/>
|
||||
</ul>
|
||||
<h2>Invocation 3 (three attributes)</h2>
|
||||
<ul>
|
||||
<my:echoAttributes dogName="Scruffy"
|
||||
catName="Fluffy"
|
||||
blowfishName="Puffy"/>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><%--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
--%>
|
||||
<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
|
||||
<html>
|
||||
<head>
|
||||
<title>JSP 2.0 Examples - Dynamic Attributes</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 Examples - Dynamic Attributes</h1>
|
||||
<hr>
|
||||
<p>This JSP page invokes a custom tag that accepts a dynamic set
|
||||
of attributes. The tag echoes the name and value of all attributes
|
||||
passed to it.</p>
|
||||
<hr>
|
||||
<h2>Invocation 1 (six attributes)</h2>
|
||||
<ul>
|
||||
<my:echoAttributes x="1" y="2" z="3" r="red" g="green" b="blue"/>
|
||||
</ul>
|
||||
<h2>Invocation 2 (zero attributes)</h2>
|
||||
<ul>
|
||||
<my:echoAttributes/>
|
||||
</ul>
|
||||
<h2>Invocation 3 (three attributes)</h2>
|
||||
<ul>
|
||||
<my:echoAttributes dogName="Scruffy"
|
||||
catName="Fluffy"
|
||||
blowfishName="Puffy"/>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
||||
21
tomcat/webapps.dist/examples/jsp/jsp2/misc/prelude.jspf
Normal file
21
tomcat/webapps.dist/examples/jsp/jsp2/misc/prelude.jspf
Normal file
@@ -0,0 +1,21 @@
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<hr>
|
||||
<center>
|
||||
This banner included with <include-prelude>
|
||||
</center>
|
||||
<hr>
|
||||
22
tomcat/webapps.dist/examples/jsp/jsp2/misc/prelude.jspf.html
Normal file
22
tomcat/webapps.dist/examples/jsp/jsp2/misc/prelude.jspf.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre><!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<hr>
|
||||
<center>
|
||||
This banner included with &lt;include-prelude&gt;
|
||||
</center>
|
||||
<hr>
|
||||
</pre></body></html>
|
||||
@@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package jsp2.examples;
|
||||
|
||||
public class BookBean {
|
||||
private final String title;
|
||||
private final String author;
|
||||
private final String isbn;
|
||||
|
||||
public BookBean( String title, String author, String isbn ) {
|
||||
this.title = title;
|
||||
this.author = author;
|
||||
this.isbn = isbn;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return this.author;
|
||||
}
|
||||
|
||||
public String getIsbn() {
|
||||
return this.isbn;
|
||||
}
|
||||
|
||||
}
|
||||
</pre></body></html>
|
||||
@@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package jsp2.examples.simpletag;
|
||||
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.tagext.SimpleTagSupport;
|
||||
|
||||
import jsp2.examples.BookBean;
|
||||
|
||||
/**
|
||||
* SimpleTag handler that pretends to search for a book, and stores
|
||||
* the result in a scoped variable.
|
||||
*/
|
||||
public class FindBookSimpleTag extends SimpleTagSupport {
|
||||
private String var;
|
||||
|
||||
private static final String BOOK_TITLE = "The Lord of the Rings";
|
||||
private static final String BOOK_AUTHOR = "J. R. R. Tolkien";
|
||||
private static final String BOOK_ISBN = "0618002251";
|
||||
|
||||
@Override
|
||||
public void doTag() throws JspException {
|
||||
BookBean book = new BookBean( BOOK_TITLE, BOOK_AUTHOR, BOOK_ISBN );
|
||||
getJspContext().setAttribute( this.var, book );
|
||||
}
|
||||
|
||||
public void setVar( String var ) {
|
||||
this.var = var;
|
||||
}
|
||||
}
|
||||
</pre></body></html>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user