[jsp]代码库
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
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 'cj1.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>
<center>
<%
request.setCharacterEncoding("utf-8");
String name=request.getParameter("name");
String password=request.getParameter("password");
String sexinfor=request.getParameter("sex");
String[] d=request.getParameterValues("dx");
String fx=request.getParameter("fx");
out.println("<br>");
if(name=="") out.println("您没有输入姓名!<br>");
else
{
out.println("您的姓名:");
out.println(name);
out.println("<br>");
}
if(password=="") out.println("您没有输入密码!<br>");
else
{
out.println("您的密码:");
out.println(password);
out.println("<br>");
}
if(sexinfor=="") out.println("您没有选择性别!<br>");
else
{
out.println("您的性别:");
out.println(sexinfor);
out.println("<br>");
}
if(d==null) out.println("您没有选择爱好!<br>");
else
{
out.println("您的爱好:");
for(int i=0;i<d.length;i++)
{
out.println(d[i]+" ");
}
out.println("<br>");
}
if(fx=="") out.println("您没有选择行业!<br>");
else
{
out.println("您的行业:");
out.println(fx);
out.println("<br>");
}
%>
</center>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
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>
<center>
<h1>用户注册信息</h1>
<form name=form action="cj1.jsp">
<p>您的姓名:<input type="text" name="name" /></p>
<p>您的密码:<input type="password" name="password" /></p>
<p>您的性别:<input type="radio" name="sex" value="男">男 <input type="radio" name="sex" value="女">女</p>
<p>您的爱好:<input type="checkbox" name="dx" value="音乐">音乐
<input type="checkbox" name="dx" value="电影">电影
<input type="checkbox" name="dx" value="阅读">阅读
<input type="checkbox" name="dx" value="旅游">旅游
<input type="checkbox" name="dx" value="运动">运动</p>
<p>您的行业:<select name="fx" size=1>
<option value="">------</option>
<option value="教育">教育</option>
<option value="私企">私企</option>
<option value="行政">行政</option>
<option value="IT">IT</option>
</select></p>
<p><input type="submit" value="填好了!"> <input type="reset" value="重置"></p>
</form>
</center>
</body>
</html>
by: 发表于:2018-05-29 09:45:10 顶(0) | 踩(0) 回复
??
回复评论