📄 guestbook.jsp
字号:
<%@ page contentType="text/html; charset=UTF-8" %>
<%--
* @author Neelesh
* @version 1.0
*
* Development Environment : Oracle9i JDeveloper
* Name of the Application : guestBook.jsp
* Creation/Modification History :
*
* Neelesh 14-Jan-2003 Created
*
* Overview of Application
* This JSP displays a feedback form where the user can enter their comments
* about the mall. All entries will be logged in the guestbook table.
*
--%>
<%@ page language="java" errorPage="errorHandler.jsp" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<HTML>
<HEAD>
<TITLE>OTN WebStore</TITLE>
<!-- To prevent caching -->
<%
response.setHeader("Cache-Control","no-cache"); // HTTP 1.1
response.setHeader("Pragma","no-cache"); // HTTP 1.0
response.setDateHeader ("Expires", -1); // Prevents caching at the proxy server
%>
<SCRIPT>
function submitForm() {
var frm = document.guestbookForm;
// Check if all the required fields have been entered by the user before
// submitting the form
if( frm.userName.value =="" ) {
alert("<bean:message key='guestbook.javascript.username'/>");
frm.userName.focus();
return ;
}
if( frm.email.value.length > 1 && frm.email.value.indexOf("@") < 1 ) {
alert("<bean:message key='guestbook.javascript.email'/>");
frm.email.focus();
return ;
}
if( !(frm.rating[0].checked || frm.rating[1].checked || frm.rating[2].checked) ) {
alert("<bean:message key='guestbook.javascript.rating'/>");
return;
}
if( frm.comments.value.length > 4000 ) {
alert("<bean:message key='guestbook.javascript.comments'/>");
frm.comments.focus();
return ;
}
frm.submit();
}
</SCRIPT>
</HEAD>
<jsp:include page="header.jsp" flush="true"></jsp:include>
<p class="ErrorText" align="center"><html:errors/></p>
<html:form action="addguestbook.do?login=true" method="post" scope="request" name="guestbookForm" type="oracle.otnsamples.vsm.actions.forms.GuestbookForm">
<TABLE width="100%" border="0" cellspacing="0" cellpadding=
"1" bgcolor="white">
<TR>
<TD width="66%" valign="top">
<TABLE width="100%" border="0" cellspacing="0"
cellpadding="3">
<TR>
<TD width="25%" class="SubHeading"><bean:message key='guestbook.contactinfo.header'/></TD>
<TD width="75%">
<HR>
</TD>
</TR>
</TABLE>
<TABLE width="100%" border="0" cellspacing="0"
cellpadding="3">
<TR>
<TD width="35%" align="right" class="Prompt"> <bean:message key='guestbook.contactinfo.name'/></TD>
<TD width="65%">
<html:text property="userName" maxlength="50"/>
</TD>
</TR>
<TR>
<TD width="35%" align="right" class="Prompt" ><bean:message key='guestbook.contactinfo.email'/></TD>
<TD width="65%">
<html:text property="email" maxlength="50"/>
</TD>
</TR>
</TABLE>
<BR>
<TABLE width="100%" border="0" cellspacing="0"
cellpadding="3">
<TR>
<TD width="18%" class="SubHeading"><bean:message key='guestbook.testimonial.header'/></TD>
<TD width="82%">
<HR>
</TD>
</TR>
</TABLE>
<TABLE width="100%" border="0" cellspacing="0"
cellpadding="3">
<TR>
<TD width="25%" align="right" class="Prompt"><bean:message key='guestbook.testimonial.rating'/></TD>
</TR>
<TR>
<TD align="right" width="25%">
<html:radio property="rating" value="3"/>
<TD width="7%" class="BlackText"><bean:message key='guestbook.testimonial.rating.excellent'/></TD>
<TD align="right" width="4%">
<html:radio property="rating" value="2"/>
</TD>
<TD width="6%" class="BlackText"><bean:message key='guestbook.testimonial.rating.good'/></TD>
<TD align="right" width="4%">
<html:radio property="rating" value="1"/>
</TD>
<TD width="54%" class="BlackText"><bean:message key='guestbook.testimonial.rating.bad'/></TD>
</TR>
</TABLE>
<BR>
<TABLE width="100%" border="0" cellspacing="0"
cellpadding="3">
<TR>
<TD class="BlackSmall"><bean:message key='guestbook.testimonial.comments'/></TD>
</TR>
<TR>
<TD align="center">
<html:textarea property="comments" rows="5" cols="80"/>
</TR>
</TABLE>
<TABLE align="center">
<TR>
<TD width="17%" height="25"> </TD>
<TD width="26%" align="right" height="25"> <A HREF="javascript:submitForm();"><IMG src="<bean:message key='images.buttons.send'/>" border="0"></A>
</TD>
<TD width="28%" height="25"> <A HREF="javascript:document.feedback.reset();"><IMG src="<bean:message key='images.buttons.reset'/>" border="0"></A>
</TD>
<TD width="29%" height="25"> </TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</html:form>
<jsp:include page="footer.jsp" flush="true"></jsp:include>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -