📄 user.jsp
字号:
<%--
* @author Shefali Bansal
* @version 1.0
*
* Name of the Application : User.jsp
* Development Environment : Oracle JDeveloper 10g
* Creation/Modification History :
*
* Shefali Bansal 02-Jan-2004 Created
*
* Overview of Application :
* This JSP displays all the seminar categories that the user can view. 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' media retrieval tag is used here.
* Here the SQL tag library is used to access the oracle database.
--%>
<%@ page language="java" %>
<%@ page errorPage="Exception.jsp" %>
<% // Get the type of the user who has logged in
String userType = request.getParameter("UserType");
// If the request parameter was set
if(userType != null) {
// Store the type of user logged in.
session.setAttribute("UserType", userType);
// String currentUserType = (String)session.getAttribute("UserType");
}
%>
<%-- 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>
<HEAD>
<TITLE>JSP Multimedia Tag Application: User Page for Viewing the Webinar Categories</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="#333333"> <font color="#990000">Hi!
You logged in as <%=(String)session.getAttribute("UserType")%>.</font></font></b></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 Category_Id, Description, Short_Desc FROM otn_webinar_categories
</sql:dbQuery>
<sql:dbNextRow queryId="myQuery">
<%
// Retrieve data from the result set.
String categoryId = myQuery.getString(1);
String description = myQuery.getString(2);
String shortDesc = myQuery.getString(3);
%>
<TR>
<TD valign="middle" noWrap height="16"> </TD>
</TR>
<%-- Begin to display the data --%>
<TR width=100%>
<TD height="52" valign="top" >
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<%-- Generate the HTML <IMG> tag that displays the image column of the OTN_WEBINAR_CATEGORIES
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="20%" valign=top align="right"><a href="ViewEvents.jsp?Category_Id=<%=categoryId%>&Short_Desc=<%=shortDesc%>&Desc=<%=description%>">
<ord:embedImage dataSourceName="jdbc/OracleDS"
table = "OTN_WEBINAR_CATEGORIES"
column = "Image"
key = "<%=categoryId%>"
keyColumn = "Category_Id"
retrievalPath="OrdGetMediaJsp.jsp"
alt = "<%=escapeHtmlString(description)%>"
border="1" /></a></td>
<td width="80%" class="bodycopy" valign="top"><u><%=shortDesc%></u><br>
<%=description%></td>
<td width="671"></td>
</tr>
</table>
</TD>
</TR>
<%-- End the loop, then close the query and the database connection. --%>
<% rowCount ++; %>
</sql:dbNextRow>
<sql:dbCloseQuery queryId="myQuery"/>
<sql:dbClose connId="myConn"/>
<%-- Display a message if the table is empty; --%>
<TR>
<TD SCOPE="col" ALIGN="CENTER" height="20"><FONT COLOR="#336699"><B><I>
<%
if (rowCount == 0)
{
out.println(" The Seminar Categories Table is empty. ");
out.println(" Please ask the Administrator to upload the Seminar Categories !!!");
}
%>
</I></B></FONT></TD>
</TR>
<TBODY>
<TR>
<TD height="16"> </TD>
</TR>
</TBODY>
</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 + -