?? viewevents.jsp
字號:
<%--
* @author Shefali Bansal
* @version 1.0
*
* Name of the Application : ViewEvents.jsp
* Development Environment : Oracle JDeveloper 10g
* Creation/Modification History :
*
* Shefali Bansal 02-Jan-2004 Created
*
* Overview of Application :
* This JSP displays all the web events that fall under a particular
* Seminar Category. This JSP uses media retrieval tags from Multimedia Tag Library
* to retrieve media data from the database and deliver it to the browser.
* The 'embedImage' and 'embedAudio' media retrieval tags are used here.
* Here the SQL tag library is used to access the oracle database.
--%>
<%@ page language="java" %>
<%@ page errorPage="Exception.jsp" %>
<%-- Specify the prefix and uri attributes. The value of the uri attribute indicates
the location of the tag library descriptor (TLD) file for the tag library.
The prefix attribute (ord) specifies the XML namespace identifier,
which should be inserted before each occurrence of the library抯 tags in the JSP page.--%>
<%@ taglib prefix="ord" uri="intermedia-taglib.tld" %>
<%@ taglib prefix="sql" uri="sqltaglib.tld" %>
<%!
/**
* Escape some of the most commonly used special chars in HTML.
*/
public static final String escapeHtmlString(String input)
{
StringBuffer sb = new StringBuffer();
for (int i = 0; i < input.length(); i++)
{
char ch = input.charAt(i);
switch (ch)
{
case '<':
sb.append("<");
break;
case '>':
sb.append(">");
break;
case '&':
sb.append("&");
break;
case '"':
sb.append(""");
break;
case ' ':
sb.append(" ");
break;
default:
sb.append(ch);
}
}
return sb.toString();
}
%>
<HTML>
<% // Get the values of the parameters passed to this JSP
String category_id = request.getParameter("Category_Id");
String short_desc = request.getParameter("Short_Desc");
String desc = request.getParameter("Desc");
%>
<HEAD>
<TITLE>JSP Multimedia Tag Application:View Events in a particular Category</TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<link rel="stylesheet" href="stylesheets/styles.css" type="text/css">
</HEAD>
<BODY text=#000000>
<!-- Main table -->
<TABLE border=0 cellPadding=0 cellSpacing=0 height=58 width=100%>
<TR>
<TD valign="top" width="100%">
<!-- Include the static 'Header.jsp' file -->
<%@ include file="Header.jsp" %>
</TD>
</TR>
<TR>
<TD width="100%">
<table WIDTH ="100%" cellspacing=0 cellpadding=0 height="100%"
bgcolor="#FFFFFF">
<tr>
<TD height="100%">
<TABLE border=0 cellPadding=1 cellSpacing=0 width="100%">
<!-- Heading of the page goes here -->
<TR >
<TD valign="middle" height="19" noWrap><b><font color="#990000"> Hi!
You logged in as <%=(String)session.getAttribute("UserType")%>.</font></b></TD>
</TR>
<TR>
<TD valign="middle" noWrap height="16"> </TD>
</TR>
<TR>
<TD valign="middle" noWrap height="16"><font color="#333366"><b><font size="4" face="Verdana, Arial, Helvetica, sans-serif">
</font><font color="#333366"><b><font size="4" face="Verdana, Arial, Helvetica, sans-serif"><%=short_desc%></font></b></font></b></font></TD>
</TR>
<TR>
<TD valign="middle" noWrap height="16"><i><font size="3"><%=desc%></font></i></TD>
</TR>
<TR>
<TD valign="middle" noWrap height="32"> </TD>
</TR>
<TR>
<TD valign="middle" noWrap height="16"><font color="#000000"><b><font face="Verdana, Arial, Helvetica, sans-serif">Click
on any of the Video or the Audio titles below to get started
!!!</font></b></font></TD>
</TR>
<TR>
<TD valign="middle" noWrap height="16">
<table width="100%" border="1" cellpadding="5" cellspacing="1" bordercolor="#663366">
<tr bgcolor="#FFFFCC">
<td width="10%" valign="top" class="boldbodycopy" height="23"> </td>
<td width="45%" valign="top" class="boldbodycopy" height="23"> </td>
<td width="20%" valign="top" class="boldbodycopy" height="23" align="center"><font color="#000000"><b>Watch
It Now (Real Media)</b></font></td>
<td width="25%" valign="top" class="boldbodycopy" height="23" align="center">
<font color="#000000"><b>Hear It Now (MP3)</b><span class="tdsmall"></span></font></td>
</tr>
<%-- Open the database connection, perform the query on the OTN_WEBINAR_CATEGORIES table,
and then loop over the retrieved result set.--%>
<% int rowCount = 0; %>
<sql:dbOpen connId = "myConn" dataSource="jdbc/OracleDS" />
<sql:dbQuery connId = "myConn" queryId="myQuery" output="jdbc">
SELECT Event_Id, Description FROM OTN_WEBINAR_EVENTS where Category_Id = '<%=category_id%>'
</sql:dbQuery>
<sql:dbNextRow queryId="myQuery">
<%
// Retrieve data from the result set.
String event_id = myQuery.getString(1);
String event_description = myQuery.getString(2);
%>
<tr bgcolor="#FFFFEA">
<%-- Generate the HTML <IMG> tag that displays the image column of the OTN_WEBINAR_EVENTS
table. The HTML <A HREF> tag uses the JSP tag embedImage as the link anchor.
This line of code shows the Multimedia JSP tag embedImage.--%>
<td width="10%" align="center" valign="middle">
<ord:embedImage dataSourceName="jdbc/OracleDS"
table = "OTN_WEBINAR_EVENTS"
column = "Image"
key = "<%=event_id%>"
keyColumn = "Event_Id"
retrievalPath="OrdGetMediaJsp.jsp"
alt = "<%=escapeHtmlString(event_description)%>"
border="1" /> </td>
<td width="40%" valign="middle" class="bodycopy" align="left" >
<%=event_description%></td>
<td width="15%" valign="middle" align="center"><a href="ViewVideo.jsp?Event_Id=<%=event_id%>&Event_Desc=<%=event_description%>&Short_Desc=<%=short_desc%>"><font color="#0033CC"><u>View
Video</u></font></a></td>
<td width="25%" valign="middle" class="bodycopy" align="center">
<%-- Generate the HTML <EMBED> and <OBJECT> tags where the audio data from OTN_WEBINAR_EVENTS
table is delivered directly from the database to a browser plug-in.
This line of code shows the Multimedia JSP tag embedAudio.--%>
<ord:embedAudio dataSourceName="jdbc/OracleDS"
table = "OTN_WEBINAR_EVENTS"
column = "Audio"
key = "<%=event_id%>"
keyColumn = "Event_Id"
alt = "OTN Greetings"
helperApp = "mediaPlayer"
height = "90" width = "200"
showControls = "true"
autoStart = "false"
loop = "true"
standby = "Loading media player components ..." />
</td>
</tr>
<%-- End the loop, then close the query and the database connection. --%>
<% rowCount ++; %>
</sql:dbNextRow>
<sql:dbCloseQuery queryId="myQuery"/>
<sql:dbClose connId="myConn"/>
</table></TD>
</TR>
<TR>
<TD valign="middle" noWrap height="32"> </TD>
</TR>
<%-- Display a message if the table is empty; --%>
<% if (rowCount == 0) { %>
<TR>
<TD SCOPE="col" ALIGN="CENTER" height="20"><FONT COLOR="#336699"><B><I>
<font color="#C60000" size="3">There is no Event available for
viewing in this Category !!!</font> </I></B></FONT></TD>
</TR>
<TR>
<TD valign="middle" noWrap height="32"> </TD>
</TR>
<% } %>
<TR>
<TD height="16" align="center"><a href="User.jsp"><img src="images/viewother.gif" width="148" height="22" border="0"></a> </TD>
</TR>
</TABLE>
</TD>
</tr>
</table>
</td>
</TR>
<TR>
<%@ include file="Footer.jsp" %>
</TR>
</TABLE>
<!-- Main table ends here-->
</BODY>
</HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -