📄 profile.jsp
字号:
<%@ page contentType="text/html; charset=UTF-8" %>
<%--
* @author Sujatha
* @version 1.0
*
* Development Environment : Oracle9i JDeveloper
* Name of the Application : profile.jsp
* Creation/Modification History :
*
* Sujatha 27-Dec-2001 Created
* Sujatha 07-Jan-2003 Incorporated Struts framework
*
* Overview of Application
* This jsp displays the users profile. They can alter any information
* and submit the changes.
*
--%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ page import="java.util.TreeMap"%>
<%@ page import="oracle.otnsamples.vsm.actions.forms.ProfileForm"%>
<HEAD>
<TITLE><bean:message key="title.profile"/></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 SRC="includes/utils.js">
</SCRIPT>
<SCRIPT>
function submitForm() {
var frm = document.forms[1];
// Check if all the required fields have been entered by the user before
// submitting the form
if( trim(frm.firstName.value).length < 1 ) {
alert("<bean:message key='profile.javascript.firstnameerror'/>");
frm.firstName.focus();
return ;
}
if( trim(frm.lastName.value).length < 1 ) {
alert("<bean:message key='profile.javascript.lastnameerror'/>");
frm.lastName.focus();
return ;
}
if( trim(frm.email.value).length < 1 ) {
alert("<bean:message key='profile.javascript.emailerror'/>");
frm.email.focus();
return ;
}
if( frm.email.value.indexOf("@") < 1 ) {
alert("<bean:message key='profile.javascript.emailinvaliderror'/>");
frm.email.focus();
return ;
}
if( trim(frm.address.value).length < 1 ) {
alert("<bean:message key='address.javascript.addresserror'/>");
frm.address.focus();
return ;
}
if( frm.address.value.length > 100 ) {
alert("<bean:message key='address.javascript.addresslimiterror'/>");
frm.address.focus();
return ;
}
if( trim(frm.city.value).length < 1 ) {
alert("<bean:message key='address.javascript.cityerror'/>");
frm.city.focus();
return ;
}
if( trim(frm.state.value).length < 1 ) {
alert("<bean:message key='address.javascript.stateerror'/>");
frm.state.focus();
return ;
}
var zip = frm.zip.value;
if( trim(zip).length < 1 ) {
alert("<bean:message key='address.javascript.zipcodeerror'/>");
frm.zip.focus();
return ;
}
if( isNaN(zip) ) {
alert("<bean:message key='address.javascript.zipcodeformaterror'/>");
frm.zip.focus();
return ;
}
if( trim(frm.phone.value).length < 1 ) {
alert("<bean:message key='address.javascript.phoneerror'/>");
frm.phone.focus();
return ;
}
if( trim(frm.cardProvider.value).length < 1 ) {
alert("<bean:message key='login.javascript.ccprovidererror'/>");
frm.cardProvider.focus();
return ;
}
expDate = frm.cardExpiryDate.value;
if( trim(expDate).length < 1 ) {
alert("<bean:message key='login.javascript.ccdateerror'/>");
frm.cardExpiryDate.focus();
return ;
}
if( trim(expDate).length != 7 ) {
alert("<bean:message key='login.javascript.ccdateformaterror'/>");
frm.cardExpiryDate.focus();
return ;
}
var now = new Date();
currMonth = now.getMonth()+1;
currYear = now.getFullYear();
// Check to see if the expiry date is a single digit and then
// separate Year, month and day
Expmonthval = (trim(expDate)).substring(0,2);
ExpYear = (trim(expDate)).substring(3,7);
if ( parseInt(Expmonthval,10) > 12 || parseInt(Expmonthval,10) < 1 ) {
alert("<bean:message key='login.javascript.ccdatemontherror'/>");
frm.cardExpiryDate.focus();
return;
}
if ( parseInt(ExpYear) < currYear || (parseInt(ExpYear) == currYear
&& parseInt(Expmonthval,10) < currMonth )) {
alert("<bean:message key='login.javascript.ccdateexpirederror'/>");
frm.cardExpiryDate.focus();
return ;
}
frm.submit();
}
</SCRIPT>
</HEAD>
<jsp:include page="header.jsp" flush="true"></jsp:include>
<html:form action="profileredirect.do" scope="request" name="profile" type="oracle.otnsamples.vsm.actions.forms.ProfileForm">
<TABLE width="100%" border="0" cellspacing="1" cellpadding="1"
bgcolor="white">
<TR>
<TD width="17%" valign="top">
<logic:present role="shopowner">
<jsp:include page="../shopOwner/leftNavigation.jsp" flush="true"></jsp:include>
</logic:present>
</TD>
<TD valign="top">
<TABLE width="100%">
<TR>
<TD width="20%" class="SubHeading"><bean:message key="subheading.user"/></TD>
<TD width="80%">
<HR>
</TD>
</TR>
<logic:present name="message" scope="request">
<TR>
<TD width="20%" align="center" class="ErrorText" colspan="2">
<img src="images/warning.gif">
<bean:write name="message" scope="request"/>
</TD>
</TR>
</logic:present>
</TABLE>
<BR>
<TABLE width="100%" border="0" cellspacing="0"
cellpadding="3">
<TR>
<TD width="17%" class="Prompt" align="right"><bean:message key="prompt.firstName"/></TD>
<TD width="29%">
<html:text property="firstName" size="25" maxlength="20"/>
</TD>
<TD width="13%" align="right" class="Prompt"><bean:message key="prompt.lastName"/></TD>
<TD width="41%">
<html:text property="lastName" size="25" maxlength="20"/>
</TD>
</TR>
<TR>
<TD width="17%" class="Prompt" align="right"> <bean:message key="prompt.address"/></TD>
<TD width="29%">
<html:textarea property="address" rows="3" cols="30"/>
</TD>
<TD width="13%" class="Prompt" align="right"> <bean:message key="prompt.email"/></TD>
<TD width="41%">
<html:text property="email" size="25" maxlength="50"/>
</TD>
</TR>
<TR>
<TD width="17%" class="Prompt" align="right"> <bean:message key="prompt.city"/></TD>
<TD width="29%">
<html:text property="city" maxlength="20" size="25"/>
</TD>
</TR>
<TR>
<TD width="17%" class="Prompt" align="right"> <bean:message key="prompt.state"/></TD>
<TD width="29%">
<html:text property="state" maxlength="20" size="25"/>
</TD>
</TR>
<TR>
<TD width="17%" class="Prompt" align="right"><bean:message key="prompt.country"/></TD>
<TD width="29%">
<html:select property="countryID" name="profile">
<logic:iterate collection="<%=(TreeMap)request.getAttribute(\"countries\")%>" id="country" type="java.util.Map.Entry">
<html:option value="<%=country.getKey()%>"><bean:write name="country" property="value"/></html:option>
</logic:iterate>
</html:select>
</TD>
</TR>
<TR>
<TD width="17%" class="Prompt" align="right"><bean:message key="prompt.zip"/></TD>
<TD width="29%">
<html:text property="zip" maxlength="8" size="15"/>
</TD>
</TR>
<TR>
<TD width="17%" height="42" class="Prompt" align=
"right"><bean:message key="prompt.phone"/></TD>
<TD width="29%" height="42">
<html:text property="phone" maxlength="20" size="25"/>
</TD>
</TR>
<TR>
<TD width="17%" class="Prompt" align="right"> <bean:message key="prompt.cardProvider"/></TD>
<TD width="29%">
<html:text property="cardProvider" maxlength="30" size="25"/>
</TD>
<TD width="13%" align="right" class="Prompt"> <bean:message key="prompt.cardNumber"/></TD>
<TD width="41%">
<html:text property="cardNumber" maxlength="16" size="25"/>
</TD>
</TR>
<TR>
<TD width="17%" class="Prompt" align="right"><bean:message key="prompt.expiryDate"/></TD>
<TD width="29%" align="left">
<html:text property="cardExpiryDate" maxlength="20" size="25"/>
</TD>
<TD width="13%"> </TD>
<TD width="41%"> </TD>
</TR>
<TR>
<TD> </TD>
</TR>
</TABLE>
<BR>
<TABLE width="50%" border="0" cellspacing="0" cellpadding="3" align=center>
<TR>
<TD width="30%"> </TD>
<TD width="10%" align="right"> <A HREF="javascript:submitForm()">
<html:img srcKey="image.update" border="0"/></A> </TD>
<TD width="10%" align="center">
<A HREF="javascript:document.forms[1].reset();">
<html:img srcKey="image.reset" border="0"/></A> </TD>
<TD width="10%" align="left"> <A HREF="main.do?login=true">
<html:img srcKey="image.cancel" border="0"/></A> </TD>
<TD width="29%"> </TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</html:form>
<jsp:include page="commonFooter.jsp" flush="true"></jsp:include>
</BODY>
</html:html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -