J2EE_Web开发.
2 / 9
实验1. 在Eclipse中开发Web应用
实验内容
在这个实验中,将学习在Eclipse+MyEclipse ,创建JSP、JavaBean、Servlet,并测试。
实验目的
。
在主菜单中选择[New]à[JSP〔Advanced Templates]或者右键点击工程上的[WebRoot]并在弹出菜单中选择[New]à[JSP〔Advanced Templates],都会弹出Create a new JSP Page对话框。在File Path中输入或确认/myweb/WebRoot,在File ,点击[Finish]。
.
3 / 9
注意:如果没有[JSP〔Advanced Templates]则选择[New]à[Other],在弹出的菜单中再选择[MyEclipse]à[Web]à[JSP]。
,如下:
<% page contentType="text/html;charset=gb2312"%>
<script language="JavaScript">
function isValidate<form>
{
// 得到用户输入的信息
username = ;
userpass = ;
// 判断用户名长度
if<!minLength<username,6>>
{
alert<"用户名长度小于6位!">;
<>;
return false;
}
if<!maxLength<username,8>>
{
alert<"用户名长度大于8位!">;
<>;
return false;
}
// 判断口令长度
if<!minLength<userpass,6>>
{
alert<"口令长度小于6位!">;
<>;
return false;
}
if<!maxLength<userpass,8>>
{
alert<"口令长度大于8位!">;
<>;
return false;
}
return true;
}
// 验证是否满足最小长度
function minLength<str,length>
{
if<>=length>
return true;
else
.
4 / 9
return false;
}
// 判断是否满足最大长度
function maxLength<str,length
J2EE Web开发 来自淘豆网m.daumloan.com转载请标明出处.