Grosse MàJ
This commit is contained in:
@ -0,0 +1,74 @@
|
||||
<html><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.Hashtable;
|
||||
import javax.servlet.http.*;
|
||||
|
||||
public class Entries {
|
||||
|
||||
private Hashtable 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 Hashtable (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 (Entry)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");
|
||||
((Entry)entries.get(time[index])).setDescription (descr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</pre></body></html>
|
@ -0,0 +1,57 @@
|
||||
<html><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 {
|
||||
|
||||
String hour;
|
||||
String description;
|
||||
String color;
|
||||
|
||||
public Entry (String hour) {
|
||||
this.hour = hour;
|
||||
this.description = "";
|
||||
|
||||
}
|
||||
|
||||
public String getHour () {
|
||||
return this.hour;
|
||||
}
|
||||
|
||||
public String getColor () {
|
||||
if (description.equals("")) return "lightblue";
|
||||
else return "red";
|
||||
}
|
||||
|
||||
public String getDescription () {
|
||||
if (description.equals("")) return "None";
|
||||
else return this.description;
|
||||
}
|
||||
|
||||
public void setDescription (String descr) {
|
||||
description = descr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</pre></body></html>
|
@ -0,0 +1,156 @@
|
||||
<html><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.*;
|
||||
|
||||
public class JspCalendar {
|
||||
Calendar calendar = null;
|
||||
Date currentDate;
|
||||
|
||||
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>
|
@ -0,0 +1,102 @@
|
||||
<html><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 javax.servlet.http.*;
|
||||
import java.util.Hashtable;
|
||||
|
||||
public class TableBean {
|
||||
|
||||
Hashtable table;
|
||||
JspCalendar JspCal;
|
||||
Entries entries;
|
||||
String date;
|
||||
String name = null;
|
||||
String email = null;
|
||||
boolean processError = false;
|
||||
|
||||
public TableBean () {
|
||||
this.table = new Hashtable (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 = (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>
|
95
P51/apache-tomcat-6.0.14/webapps/examples/jsp/cal/cal1.jsp
Normal file
95
P51/apache-tomcat-6.0.14/webapps/examples/jsp/cal/cal1.jsp
Normal file
@ -0,0 +1,95 @@
|
||||
<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>
|
||||
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>
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,97 @@
|
||||
<html><body><pre>
|
||||
<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>
|
||||
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
P51/apache-tomcat-6.0.14/webapps/examples/jsp/cal/cal2.jsp
Normal file
45
P51/apache-tomcat-6.0.14/webapps/examples/jsp/cal/cal2.jsp
Normal file
@ -0,0 +1,45 @@
|
||||
<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>
|
||||
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>
|
||||
|
@ -0,0 +1,47 @@
|
||||
<html><body><pre>
|
||||
<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>
|
||||
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>
|
@ -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
P51/apache-tomcat-6.0.14/webapps/examples/jsp/cal/login.html
Normal file
47
P51/apache-tomcat-6.0.14/webapps/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 demostartes a way JSP can be
|
||||
used with html tables and forms.</font>
|
||||
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
32
P51/apache-tomcat-6.0.14/webapps/examples/jsp/chat/chat.jsp
Normal file
32
P51/apache-tomcat-6.0.14/webapps/examples/jsp/chat/chat.jsp
Normal file
@ -0,0 +1,32 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<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>JSP Chat</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
|
||||
<!-- Body -->
|
||||
<frameset>
|
||||
<frame name="post" src="post.jsp" scrolling="no" title="Post message">
|
||||
<frame name="chat" src="chat" scrolling="yes" title="Chat">
|
||||
</frameset>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,34 @@
|
||||
<html><body><pre>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<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>JSP Chat</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
|
||||
<!-- Body -->
|
||||
<frameset>
|
||||
<frame name="post" src="post.jsp" scrolling="no" title="Post message">
|
||||
<frame name="chat" src="chat" scrolling="yes" title="Chat">
|
||||
</frameset>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
31
P51/apache-tomcat-6.0.14/webapps/examples/jsp/chat/login.jsp
Normal file
31
P51/apache-tomcat-6.0.14/webapps/examples/jsp/chat/login.jsp
Normal file
@ -0,0 +1,31 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<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>JSP Chat</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
|
||||
<form method="POST" action='chat' name="loginForm">
|
||||
<input type="hidden" name="action" value="login"/>
|
||||
Nickname: <input type="text" name="nickname"/>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,33 @@
|
||||
<html><body><pre>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<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>JSP Chat</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
|
||||
<form method="POST" action='chat' name="loginForm">
|
||||
<input type="hidden" name="action" value="login"/>
|
||||
Nickname: <input type="text" name="nickname"/>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
36
P51/apache-tomcat-6.0.14/webapps/examples/jsp/chat/post.jsp
Normal file
36
P51/apache-tomcat-6.0.14/webapps/examples/jsp/chat/post.jsp
Normal file
@ -0,0 +1,36 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<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>JSP Chat</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
|
||||
<form method="POST" action='chat' name="postForm">
|
||||
<input type="hidden" name="action" value="post"/>
|
||||
Message: <input type="text" name="message"/>
|
||||
</form>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<a href="javascript:openWindow('http://127.0.0.1:8080/examples/jsp/chat/chat', 640, 480 ,0 ,0 ,0 ,0 ,0 ,1 ,10 ,10 )">Click to open chat window</a>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,38 @@
|
||||
<html><body><pre>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<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>JSP Chat</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF">
|
||||
|
||||
<form method="POST" action='chat' name="postForm">
|
||||
<input type="hidden" name="action" value="post"/>
|
||||
Message: <input type="text" name="message"/>
|
||||
</form>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<a href="javascript:openWindow('http://127.0.0.1:8080/examples/jsp/chat/chat', 640, 480 ,0 ,0 ,0 ,0 ,0 ,1 ,10 ,10 )">Click to open chat window</a>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
@ -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>
|
@ -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>
|
@ -0,0 +1,64 @@
|
||||
<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=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 (int i = 0; i < fruits.length; i++) {
|
||||
%>
|
||||
<li>
|
||||
<%
|
||||
out.println (util.HTMLFilter.filter(fruits[i]));
|
||||
}
|
||||
} 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 (int i = 0; i < fruits.length; i++) {
|
||||
%>
|
||||
<li>
|
||||
<%
|
||||
out.println (util.HTMLFilter.filter(fruits[i]));
|
||||
}
|
||||
} else out.println ("none selected");
|
||||
%>
|
||||
</ul>
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,66 @@
|
||||
<html><body><pre>
|
||||
<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=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 (int i = 0; i < fruits.length; i++) {
|
||||
%>
|
||||
<li>
|
||||
<%
|
||||
out.println (util.HTMLFilter.filter(fruits[i]));
|
||||
}
|
||||
} 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 (int i = 0; i < fruits.length; i++) {
|
||||
%>
|
||||
<li>
|
||||
<%
|
||||
out.println (util.HTMLFilter.filter(fruits[i]));
|
||||
}
|
||||
} else out.println ("none selected");
|
||||
%>
|
||||
</ul>
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
@ -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>
|
@ -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>
|
@ -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>
|
@ -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>
|
@ -0,0 +1,70 @@
|
||||
<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.
|
||||
-->
|
||||
|
||||
<jsp:useBean id="cb" scope="session" class="colors.ColorGameBean" />
|
||||
<jsp:setProperty name="cb" property="*" />
|
||||
|
||||
<%
|
||||
cb.processRequest(request);
|
||||
%>
|
||||
|
||||
<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>
|
@ -0,0 +1,72 @@
|
||||
<html><body><pre>
|
||||
<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.
|
||||
-->
|
||||
|
||||
<jsp:useBean id="cb" scope="session" class="colors.ColorGameBean" />
|
||||
<jsp:setProperty name="cb" property="*" />
|
||||
|
||||
<%
|
||||
cb.processRequest(request);
|
||||
%>
|
||||
|
||||
<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>
|
@ -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
P51/apache-tomcat-6.0.14/webapps/examples/jsp/dates/date.jsp
Normal file
41
P51/apache-tomcat-6.0.14/webapps/examples/jsp/dates/date.jsp
Normal file
@ -0,0 +1,41 @@
|
||||
<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.
|
||||
-->
|
||||
|
||||
<%@ 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>
|
@ -0,0 +1,43 @@
|
||||
<html><body><pre>
|
||||
<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.
|
||||
-->
|
||||
|
||||
<%@ 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
P51/apache-tomcat-6.0.14/webapps/examples/jsp/error/er.html
Normal file
31
P51/apache-tomcat-6.0.14/webapps/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
P51/apache-tomcat-6.0.14/webapps/examples/jsp/error/err.jsp
Normal file
44
P51/apache-tomcat-6.0.14/webapps/examples/jsp/error/err.jsp
Normal file
@ -0,0 +1,44 @@
|
||||
<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="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>
|
||||
|
@ -0,0 +1,46 @@
|
||||
<html><body><pre>
|
||||
<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="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>
|
@ -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>
|
@ -0,0 +1,25 @@
|
||||
<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="red">
|
||||
|
||||
<%@ page isErrorPage="true" %>
|
||||
<h1> The exception <%= exception.getMessage() %> tells me you
|
||||
made a wrong choice.
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,27 @@
|
||||
<html><body><pre>
|
||||
<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="red">
|
||||
|
||||
<%@ page isErrorPage="true" %>
|
||||
<h1> The exception <%= exception.getMessage() %> tells me you
|
||||
made a wrong choice.
|
||||
</body>
|
||||
</html>
|
||||
</pre></body></html>
|
@ -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.
|
||||
-->
|
||||
|
||||
<%
|
||||
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>
|
@ -0,0 +1,36 @@
|
||||
<html><body><pre>
|
||||
<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.
|
||||
-->
|
||||
|
||||
<%
|
||||
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>
|
@ -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>
|
@ -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>
|
@ -0,0 +1,25 @@
|
||||
<html><body><pre>
|
||||
<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>
|
||||
</pre></body></html>
|
@ -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
P51/apache-tomcat-6.0.14/webapps/examples/jsp/images/code.gif
Normal file
BIN
P51/apache-tomcat-6.0.14/webapps/examples/jsp/images/code.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 292 B |
BIN
P51/apache-tomcat-6.0.14/webapps/examples/jsp/images/execute.gif
Normal file
BIN
P51/apache-tomcat-6.0.14/webapps/examples/jsp/images/execute.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
P51/apache-tomcat-6.0.14/webapps/examples/jsp/images/read.gif
Normal file
BIN
P51/apache-tomcat-6.0.14/webapps/examples/jsp/images/read.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
P51/apache-tomcat-6.0.14/webapps/examples/jsp/images/return.gif
Normal file
BIN
P51/apache-tomcat-6.0.14/webapps/examples/jsp/images/return.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@ -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
|
@ -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.
|
||||
-->
|
||||
|
||||
<body bgcolor="white">
|
||||
<font color="red">
|
||||
|
||||
<%= System.currentTimeMillis() %>
|
@ -0,0 +1,23 @@
|
||||
<html><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.
|
||||
-->
|
||||
|
||||
<body bgcolor="white">
|
||||
<font color="red">
|
||||
|
||||
<%= System.currentTimeMillis() %>
|
||||
</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>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>
|
@ -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.
|
||||
-->
|
||||
|
||||
<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>
|
@ -0,0 +1,37 @@
|
||||
<html><body><pre>
|
||||
<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">
|
||||
|
||||
<%@ 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>
|
370
P51/apache-tomcat-6.0.14/webapps/examples/jsp/index.html
Normal file
370
P51/apache-tomcat-6.0.14/webapps/examples/jsp/index.html
Normal file
@ -0,0 +1,370 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<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>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.61 [en] (WinNT; I) [Netscape]">
|
||||
<meta name="Author" content="Anil K. Vijendran">
|
||||
<title>JSP Examples</title>
|
||||
</head>
|
||||
<body bgcolor="#FFFFFF">
|
||||
<b><font face="Arial, Helvetica, sans-serif"><font size=+2>JSP
|
||||
Samples</font></font></b>
|
||||
<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="http://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:
|
||||
<br>
|
||||
<table BORDER=0 CELLSPACING=5 WIDTH="85%" >
|
||||
<tr VALIGN=TOP>
|
||||
<td WIDTH="30"><img SRC="images/execute.gif" ></td>
|
||||
|
||||
<td>Execute the example</td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td WIDTH="30"><img SRC="images/code.gif" height=24 width=24></td>
|
||||
|
||||
<td>Look at the source code for the example</td>
|
||||
</tr>
|
||||
|
||||
<!--<tr VALIGN=TOP>
|
||||
<td WIDTH="30"><img SRC="images/read.gif" height=24 width=24></td>
|
||||
|
||||
<td>Read more about this feature</td>
|
||||
-->
|
||||
|
||||
</tr>
|
||||
<tr VALIGN=TOP>
|
||||
<td WIDTH="30"><img SRC="images/return.gif" height=24 width=24></td>
|
||||
|
||||
<td>Return to this screen</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>Tip: For session scoped beans to work, the cookies must be enabled.
|
||||
This can be done using browser options.
|
||||
<br>
|
||||
<br>
|
||||
<b><u><font size="+1">JSP 2.0 Examples</font></u></b><br>
|
||||
|
||||
<table BORDER=0 CELLSPACING=5 WIDTH="85%" >
|
||||
<tr valign=TOP>
|
||||
<td><b>Expression Language</b></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>Basic Arithmetic</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/el/basic-arithmetic.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/el/basic-arithmetic.jsp">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/el/basic-arithmetic.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/el/basic-arithmetic.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>Basic Comparisons</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/el/basic-comparisons.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/el/basic-comparisons.jsp">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/el/basic-comparisons.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/el/basic-comparisons.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>Implicit Objects</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/el/implicit-objects.jsp?foo=bar"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/el/implicit-objects.jsp?foo=bar">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/el/implicit-objects.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/el/implicit-objects.html">Source</a></td>
|
||||
</tr>
|
||||
<tr valign=TOP>
|
||||
|
||||
<td>Functions</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/el/functions.jsp?foo=JSP+2.0"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/el/functions.jsp?foo=JSP+2.0">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/el/functions.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/el/functions.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td><br><b>SimpleTag Handlers and JSP Fragments</b></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>Hello World Tag</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/simpletag/hello.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/simpletag/hello.jsp">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/simpletag/hello.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/simpletag/hello.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>Repeat Tag</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/simpletag/repeat.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/simpletag/repeat.jsp">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/simpletag/repeat.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/simpletag/repeat.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>Book Example</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/simpletag/book.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/simpletag/book.jsp">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/simpletag/book.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/simpletag/book.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td><br><b>Tag Files</b></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>Hello World Tag File</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/tagfiles/hello.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/tagfiles/hello.jsp">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/tagfiles/hello.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/tagfiles/hello.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>Panel Tag File</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/tagfiles/panel.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/tagfiles/panel.jsp">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/tagfiles/panel.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/tagfiles/panel.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>Display Products Example</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/tagfiles/products.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/tagfiles/products.jsp">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/tagfiles/products.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/tagfiles/products.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td><br><b>New JSP XML Syntax (.jspx)</b></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>XHTML Basic Example</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/jspx/basic.jspx"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/jspx/basic.jspx">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/jspx/basic.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/jspx/basic.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>SVG (Scalable Vector Graphics)</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/jspx/svgexample.html"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/jspx/svgexample.html">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/jspx/textRotate.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/jspx/textRotate.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td><br><b>Other JSP 2.0 Features</b></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td><jsp:attribute> and <jsp:body></td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/jspattribute/jspattribute.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/jspattribute/jspattribute.jsp">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/jspattribute/jspattribute.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/jspattribute/jspattribute.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>Shuffle Example</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/jspattribute/shuffle.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/jspattribute/shuffle.jsp">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/jspattribute/shuffle.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/jspattribute/shuffle.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>Attributes With Dynamic Names</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/misc/dynamicattrs.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/misc/dynamicattrs.jsp">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/misc/dynamicattrs.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/misc/dynamicattrs.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>JSP Configuration</td>
|
||||
<td valign=TOP width="30%"><a href="jsp2/misc/config.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/misc/config.jsp">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="jsp2/misc/config.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/misc/config.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<b><u><font size="+1">JSP 1.2 Examples</font></u></b><br>
|
||||
<table BORDER=0 CELLSPACING=5 WIDTH="85%" >
|
||||
<tr VALIGN=TOP>
|
||||
<td>Numberguess </td>
|
||||
|
||||
<td VALIGN=TOP WIDTH="30%"><a href="num/numguess.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="num/numguess.jsp">Execute</a></td>
|
||||
|
||||
<td WIDTH="30%"><a href="num/numguess.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="num/numguess.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>Date </td>
|
||||
|
||||
<td VALIGN=TOP WIDTH="30%"><a href="dates/date.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="dates/date.jsp">Execute</a></td>
|
||||
|
||||
<td WIDTH="30%"><a href="dates/date.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="dates/date.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>Snoop</td>
|
||||
|
||||
<td WIDTH="30%"><a href="snp/snoop.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="snp/snoop.jsp">Execute</a></td>
|
||||
|
||||
<td WIDTH="30%"><a href="snp/snoop.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="snp/snoop.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>ErrorPage </td>
|
||||
|
||||
<td WIDTH="30%"><a href="error/error.html"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="error/error.html">Execute</a></td>
|
||||
|
||||
<td WIDTH="30%"><a href="error/er.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="error/er.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>Carts </td>
|
||||
|
||||
<td VALIGN=TOP WIDTH="30%"><a href="sessions/carts.html"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="sessions/carts.html">Execute</a></td>
|
||||
|
||||
<td WIDTH="30%"><a href="sessions/crt.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="sessions/crt.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>Checkbox </td>
|
||||
|
||||
<td VALIGN=TOP WIDTH="30%"><a href="checkbox/check.html"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="checkbox/check.html">Execute</a></td>
|
||||
|
||||
<td WIDTH="30%"><a href="checkbox/cresult.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="checkbox/cresult.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>Color </td>
|
||||
|
||||
<td VALIGN=TOP WIDTH="30%"><a href="colors/colors.html"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="colors/colors.html">Execute</a></td>
|
||||
|
||||
<td WIDTH="30%"><a href="colors/clr.html.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="colors/clr.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>Calendar </td>
|
||||
|
||||
<td WIDTH="30%"><a href="cal/login.html"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="cal/login.html">Execute</a></td>
|
||||
|
||||
<td WIDTH="30%"><a href="cal/calendar.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="cal/calendar.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>Include </td>
|
||||
|
||||
<td VALIGN=TOP WIDTH="30%"><a href="/include/include.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="include/include.jsp">Execute</a></td>
|
||||
|
||||
<td WIDTH="30%"><a href="include/inc.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="include/inc.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>Forward </td>
|
||||
|
||||
<td VALIGN=TOP WIDTH="30%"><a href="forward/forward.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="forward/forward.jsp">Execute</a></td>
|
||||
|
||||
<td WIDTH="30%"><a href="forward/fwd.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="forward/fwd.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>Plugin </td>
|
||||
|
||||
<td VALIGN=TOP WIDTH="30%"><a href="plugin/plugin.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="plugin/plugin.jsp">Execute</a></td>
|
||||
|
||||
<td WIDTH="30%"><a href="plugin/plugin.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="plugin/plugin.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>JSP-Servlet-JSP </td>
|
||||
|
||||
<td VALIGN=TOP WIDTH="30%"><a href="jsptoserv/jsptoservlet.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="jsptoserv/jsptoservlet.jsp">Execute</a></td>
|
||||
|
||||
<td WIDTH="30%"><a href="jsptoserv/jts.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsptoserv/jts.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>Custom tag example</td>
|
||||
|
||||
<td VALIGN=TOP WIDTH="30%"><a href="simpletag/foo.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="simpletag/foo.jsp">Execute</a></td>
|
||||
|
||||
<td WIDTH="30%"><a href="simpletag/foo.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="simpletag/foo.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=TOP>
|
||||
<td>XML syntax example</td>
|
||||
<td valign=TOP width="30%"><a href="xml/xml.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="xml/xml.jsp">Execute</a></td>
|
||||
|
||||
<td width="30%"><a href="xml/xml.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="xml/xml.html">Source</a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<b><u><font size="+1">Tag Plugins</font></u></b><br>
|
||||
<table BORDER=0 CELLSPACING=5 WIDTH="85%" >
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>If </td>
|
||||
<td VALIGN=TOP WIDTH="30%">
|
||||
<a href="tagplugin/if.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0
|
||||
align=TOP></a>
|
||||
<a href="tagplugin/if.jsp">Execute</a>
|
||||
</td>
|
||||
<td WIDTH="30%">
|
||||
<a href="tagplugin/if.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 hei
|
||||
ght=24 width=24 align=TOP></a>
|
||||
<a href="tagplugin/if.html">Source</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>ForEach </td>
|
||||
<td VALIGN=TOP WIDTH="30%">
|
||||
<a href="tagplugin/foreach.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0
|
||||
align=TOP></a>
|
||||
<a href="tagplugin/foreach.jsp">Execute</a>
|
||||
</td>
|
||||
<td WIDTH="30%">
|
||||
<a href="tagplugin/foreach.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 hei
|
||||
ght=24 width=24 align=TOP></a>
|
||||
<a href="tagplugin/foreach.html">Source</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr VALIGN=TOP>
|
||||
<td>Choose </td>
|
||||
<td VALIGN=TOP WIDTH="30%">
|
||||
<a href="tagplugin/choose.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a>
|
||||
<a href="tagplugin/choose.jsp">Execute</a>
|
||||
</td>
|
||||
<td WIDTH="30%">
|
||||
<a href="tagplugin/choose.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a>
|
||||
<a href="tagplugin/choose.html">Source</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,45 @@
|
||||
<html><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;
|
||||
|
||||
/**
|
||||
* 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 StringBuffer( 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();
|
||||
}
|
||||
}
|
||||
</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,90 @@
|
||||
<html><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>
|
@ -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 > (4/2)}</td>
|
||||
<td>${1 > (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,118 @@
|
||||
<html><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 > (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>
|
@ -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>
|
@ -0,0 +1,66 @@
|
||||
<!--
|
||||
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="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="my" uri="http://jakarta.apache.org/tomcat/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>
|
||||
|
@ -0,0 +1,68 @@
|
||||
<html><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="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="my" uri="http://jakarta.apache.org/tomcat/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,89 @@
|
||||
<!--
|
||||
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="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 Lanaguage. 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 @@
|
||||
<html><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="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 Lanaguage. 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,38 @@
|
||||
<html><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,34 @@
|
||||
<html><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 java.io.IOException;
|
||||
|
||||
/**
|
||||
* SimpleTag handler that prints "Hello, world!"
|
||||
*/
|
||||
public class HelloWorldSimpleTag extends SimpleTagSupport {
|
||||
public void doTag() throws JspException, IOException {
|
||||
getJspContext().getOut().write( "Hello, world!" );
|
||||
}
|
||||
}
|
||||
</pre></body></html>
|
@ -0,0 +1,83 @@
|
||||
<html><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.JspFragment;
|
||||
import javax.servlet.jsp.tagext.SimpleTagSupport;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* SimpleTag handler that accepts takes three attributes of type
|
||||
* JspFragment and invokes then in a random order.
|
||||
*/
|
||||
public class ShuffleSimpleTag extends SimpleTagSupport {
|
||||
private JspFragment fragment1;
|
||||
private JspFragment fragment2;
|
||||
private JspFragment fragment3;
|
||||
|
||||
public void doTag() throws JspException, IOException {
|
||||
switch( (int)(Math.random() * 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,48 @@
|
||||
<html><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 java.io.IOException;
|
||||
|
||||
/**
|
||||
* Displays a tile as a single cell in a table.
|
||||
*/
|
||||
public class TileSimpleTag extends SimpleTagSupport {
|
||||
private String color;
|
||||
private String label;
|
||||
|
||||
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://jakarta.apache.org/tomcat/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,48 @@
|
||||
<html><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://jakarta.apache.org/tomcat/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://jakarta.apache.org/tomcat/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,92 @@
|
||||
<html><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://jakarta.apache.org/tomcat/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>
|
@ -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="basic.jspx"><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.jspx.html">Source Code for XHTML Basic Example<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,30 @@
|
||||
<tags:xhtmlbasic xmlns:tags="urn:jsptagdir:/WEB-INF/tags"
|
||||
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:directive.page contentType="text/html" />
|
||||
<head>
|
||||
<title>JSPX - XHTML Basic Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSPX - XHTML Basic Example</h1>
|
||||
<hr/>
|
||||
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 a tag file to produce the DOCTYPE and
|
||||
namespace declarations to make the output of this page a valid XHTML
|
||||
Basic 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>
|
||||
</tags:xhtmlbasic>
|
@ -0,0 +1,32 @@
|
||||
<html><body><pre>
|
||||
<tags:xhtmlbasic xmlns:tags="urn:jsptagdir:/WEB-INF/tags"
|
||||
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:directive.page contentType="text/html" />
|
||||
<head>
|
||||
<title>JSPX - XHTML Basic Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSPX - XHTML Basic Example</h1>
|
||||
<hr/>
|
||||
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 a tag file to produce the DOCTYPE and
|
||||
namespace declarations to make the output of this page a valid XHTML
|
||||
Basic 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>
|
||||
</tags:xhtmlbasic>
|
||||
</pre></body></html>
|
@ -0,0 +1,52 @@
|
||||
<!--
|
||||
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 SVG Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>JSP 2.0 SVG Example</h1>
|
||||
<hr>
|
||||
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, follow these steps:
|
||||
<ol>
|
||||
<li>Download <a href="http://xml.apache.org/batik/index.html">Batik</a>,
|
||||
or any other SVG viewer.</li>
|
||||
<li>Copy the following URL:
|
||||
<a href="http://localhost:8080/examples/jsp/jsp2/jspx/textRotate.jspx?name=JSPX">
|
||||
http://localhost:8080/examples/jsp/jsp2/jspx/textRotate.jspx?name=JSPX</a>
|
||||
</li>
|
||||
<li>Paste the URL into Batik's Location field and press Enter</li>
|
||||
<li>Customize by changing the name=JSPX parameter</li>
|
||||
</ol>
|
||||
<br>
|
||||
The following is a screenshot of the resulting image, for those that
|
||||
don't have an SVG viewer:
|
||||
<blockquote>
|
||||
<img src="textRotate.jpg" border="1">
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
@ -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="textRotate.jspx"><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="textRotate.jspx.html">Source Code for SVG (Scalable Vector Graphics)
|
||||
Example<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
@ -0,0 +1,36 @@
|
||||
<!--
|
||||
- This example is based off the textRotate.svg example that comes
|
||||
- with 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: 1.6 KiB |
@ -0,0 +1,38 @@
|
||||
<html><body><pre>
|
||||
<!--
|
||||
- This example is based off the textRotate.svg example that comes
|
||||
- with 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,56 @@
|
||||
<html><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.JspWriter;
|
||||
import javax.servlet.jsp.tagext.SimpleTagSupport;
|
||||
import javax.servlet.jsp.tagext.DynamicAttributes;
|
||||
import java.util.ArrayList;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* SimpleTag handler that echoes all its attributes
|
||||
*/
|
||||
public class EchoAttributesTag
|
||||
extends SimpleTagSupport
|
||||
implements DynamicAttributes
|
||||
{
|
||||
private ArrayList keys = new ArrayList();
|
||||
private ArrayList values = new ArrayList();
|
||||
|
||||
public void doTag() throws JspException, IOException {
|
||||
JspWriter out = getJspContext().getOut();
|
||||
for( int i = 0; i < keys.size(); i++ ) {
|
||||
String key = (String)keys.get( i );
|
||||
Object value = values.get( i );
|
||||
out.println( "<li>" + key + " = " + value + "</li>" );
|
||||
}
|
||||
}
|
||||
|
||||
public void setDynamicAttribute( String uri, String localName,
|
||||
Object value )
|
||||
throws JspException
|
||||
{
|
||||
keys.add( localName );
|
||||
values.add( value );
|
||||
}
|
||||
}
|
||||
</pre></body></html>
|
@ -0,0 +1,5 @@
|
||||
<hr>
|
||||
<center>
|
||||
This banner included with <include-coda>
|
||||
</center>
|
||||
<hr>
|
@ -0,0 +1,7 @@
|
||||
<html><body><pre>
|
||||
<hr>
|
||||
<center>
|
||||
This banner included with &lt;include-coda&gt;
|
||||
</center>
|
||||
<hr>
|
||||
</pre></body></html>
|
@ -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>
|
@ -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://jakarta.apache.org/tomcat/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.
|
||||
|
@ -0,0 +1,34 @@
|
||||
<html><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://jakarta.apache.org/tomcat/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>
|
@ -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>
|
@ -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://jakarta.apache.org/tomcat/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,46 @@
|
||||
<html><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://jakarta.apache.org/tomcat/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>
|
@ -0,0 +1,5 @@
|
||||
<hr>
|
||||
<center>
|
||||
This banner included with <include-prelude>
|
||||
</center>
|
||||
<hr>
|
@ -0,0 +1,7 @@
|
||||
<html><body><pre>
|
||||
<hr>
|
||||
<center>
|
||||
This banner included with &lt;include-prelude&gt;
|
||||
</center>
|
||||
<hr>
|
||||
</pre></body></html>
|
@ -0,0 +1,46 @@
|
||||
<html><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 String title;
|
||||
private String author;
|
||||
private 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,46 @@
|
||||
<html><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. Tolkein";
|
||||
private static final String BOOK_ISBN = "0618002251";
|
||||
|
||||
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>
|
@ -0,0 +1,45 @@
|
||||
<html><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;
|
||||
|
||||
/**
|
||||
* 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 StringBuffer( 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();
|
||||
}
|
||||
}
|
||||
</pre></body></html>
|
@ -0,0 +1,34 @@
|
||||
<html><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 java.io.IOException;
|
||||
|
||||
/**
|
||||
* SimpleTag handler that prints "Hello, world!"
|
||||
*/
|
||||
public class HelloWorldSimpleTag extends SimpleTagSupport {
|
||||
public void doTag() throws JspException, IOException {
|
||||
getJspContext().getOut().write( "Hello, world!" );
|
||||
}
|
||||
}
|
||||
</pre></body></html>
|
@ -0,0 +1,44 @@
|
||||
<html><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 java.io.IOException;
|
||||
|
||||
/**
|
||||
* SimpleTag handler that accepts a num attribute and
|
||||
* invokes its body 'num' times.
|
||||
*/
|
||||
public class RepeatSimpleTag extends SimpleTagSupport {
|
||||
private int num;
|
||||
|
||||
public void doTag() throws JspException, IOException {
|
||||
for (int i=0; i<num; i++) {
|
||||
getJspContext().setAttribute("count", String.valueOf( i + 1 ) );
|
||||
getJspBody().invoke(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
}
|
||||
</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="book.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="book.jsp.html">Source Code for the Book Example JSP<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
<h3><a href="FindBookSimpleTag.java.html">Source Code for the FindBook SimpleTag Handler<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
<h3><a href="BookBean.java.html">Source Code for BookBean<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
<h3><a href="Functions.java.html">Source Code for the EL Functions<font color="#0000FF"></a>
|
||||
</font> </h3>
|
||||
|
||||
</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