<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body bgcolor=cyan>
<font size =3>
<p>请输入E-mail:<BR>
<form action=""method=get name=form>
<input type="text"name="client"value="1">
<input type="submit"value="送出"name=submit>
</form>
<%!
String str=request.getParameter("client");
if(str!=null)
{
int index=str.indexOf("@");
if(index==-1)
{
%>
<BR>您的E-mail地址中没有@。
<%
}
else
{
int space=str.indexOf(" ");
if(space!=-1)
{
%>
<BR>您的E-mail地址含有非法的空格。
<%
}
else
{
int start=str.indexOf("@");
int end =str.lastIndexOf("@");
if(start!=end)
{
%>
<BR>您的E-mail地址有两个以上的符号:@.
<%
}
else
{
out.println("<BR>+str");
%>
您的E-mail地址书写正确。
<%
}
}
}
}
%>
</font>
</body>
</html>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body bgcolor=cyan>
<font size =3>
<p>请输入E-mail:<BR>
<form action=""method=get name=form>
<input type="text"name="client"value="1">
<input type="submit"value="送出"name=submit>
</form>
<%!
String str=request.getParameter("client");
if(str!=null)
{
int index=str.indexOf("@");
if(index==-1)
{
%>
<BR>您的E-mail地址中没有@。
<%
}
else
{
int space=str.indexOf(" ");
if(space!=-1)
{
%>
<BR>您的E-mail地址含有非法的空格。
<%
}
else
{
int start=str.indexOf("@");
int end =str.lastIndexOf("@");
if(start!=end)
{
%>
<BR>您的E-mail地址有两个以上的符号:@.
<%
}
else
{
out.println("<BR>+str");
%>
您的E-mail地址书写正确。
<%
}
}
}
}
%>
</font>
</body>
</html>
解决方案 »
- 怎样上传文件到java web项目中,而不是tomcat服务器中
- 解析XML的问题
- 急需啊
- 关于DW中的代码提示。。
- 在广域网上传输大文件常用的技术
- 2000分求助,关于dsoframer装载的EXCEL文件提交到服务端接收时,时有文件损坏的问题,分不够再开贴给分,项者有分
- appfuse中html:text当鼠标单击后总是把内容全部选中是怎么回事?
- 请教中文编码问题,3个字就出乱码!
- 自定义tag时jsp报错incompatible object argument for function call
- 关于javabean的两个问题
- 求各路大神相助啊!!JSP :Unable to load class for JSP
- 菜鸟求助关于jsp中el嵌套的问题
String str=request.getParameter("client");
if(str!=null)
{
int index=str.indexOf("@");
if(index==-1)
{
%><%! %>是用来定义成员变量或成员方法的