本学期开始学jsp了,要制作一个简单的JSP商店,请教一下

sonoffreedom 2009-04-08 03:12:23
本学期开始学jsp了,要制作一个简单的JSP商店,请教一下~_~
我做了一个简单的商城主页名为index.jsp,里面有登录框与密码框,我想设计成,输入账号与密码后,点击"确认"按钮,就把登录框与密码框还有确认按钮隐藏起来,请问应该如何做呢,最好给代码,感谢了啊!

p.s:主要的问题就是,登陆成功后,如何:1.有参数返回index.jsp并且隐藏登录框与密码框控件; 2.登录成功后跳转到check.jsp 在5秒内返回index.jsp

------------------------------------
index.jsp代码如下:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="error.page" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>举仔软件商店</title>
<style type="text/css">
<!--
.STYLE1 {
font-size: 18px;
font-weight: bold;
}
.STYLE2 {
font-size: 18;
color: #0000FF;
}
.STYLE3 {
font-size: 18;
color: #FF0000;
}
.STYLE4 {
color: #0000FF;
font-weight: bold;
}
.STYLE5 {
font-size: 16;
color: #0000FF;
}
.style6 {
font-family: "微软雅黑";
font-size: 16px;
}
.style8 {color: #FF0000}
.style9 {color: #0000FF}
.style10 {font-size: 15px}
.style11 {font-family: "微软雅黑"; font-size: 15px; }
-->
</style>
</head>

<body>
<Script language="JavaScript">
function check()
{
if (form1.userid.value=="")
{
alert("用户名未输入!");
return false;
}
if (form1.password.value=="")
{
alert("您没有输入密码!!");
return false;
}

}
function visibilityHideUI()
{

var ui = document.getElementById("form1");
ui.style.visibility="hidden";
}


</SCRIPT>
<%
String strNum = (String) application.getAttribute("Num");
int Num = 1;
if (strNum != null)
Num = Integer.parseInt(strNum) + 1;
application.setAttribute("Num", String.valueOf(Num));

%>
<div align="center">
<p align="left" class="STYLE1">~_~ 举仔的软件商店</p>
</div>
<hr />
<p class="style6">欢迎光临举仔软件店!Made by 举仔工作室. 软件店目前出售以下软件产品:</p>
<p class="style6"><strong>SoftFalcon、FalconDataBase、举仔仪器设备管理系统</strong></p>
<table width="824" border="1">
<tr>
<td width="223" valign="top" class="style6"><p class="style8"> </p>
<form id="form1" name="form1" method="get" action="check.jsp">
<p>
<label>账号
<input name="userid" id="userid" type="text" value="guest" maxlength="32" />
</label>
</p>
<p>
<label>密码
<input name="password" type="password" maxlength="32" />
</label>
</p>
<p>
<label>
<input type="submit" name="Submit" value="确 认" OnClick=check() />
<input type="button" name="clear" value="CLEAR" OnClick='visibilityHideUI()' />
</label>
<span class="style9"><a href="registor.jsp">注册新用户</a></span></p>
</form>
<p></p></td>
<td width="516" class="style6"><p><span class="STYLE4">SoftFalcon</span>是一款软件测试软件,为您提供了便利软件测试。<a href="http://www.zonej.cn">详情...</a></p>
<p><span class="STYLE4">FalconDataBase</span>是一款轻型数据库系统,为您提供快速高效的数据库服务。<a href="http://www.zonej.cn">详情...</a></p>
<p><span class="STYLE4">举仔仪器管理系统</span>为中小企业提供良好的仪器管理方案。<a href="http://www.zonej.cn">详情...</a></p>
<p class="style9">商品分类:软件产品 / 网站开发 / 数据库维护</p></td>
</tr>
</table>
<table width="828" height="140" border="1">
<tr>
<td width="253" valign="top" class="style6 style10"><p class="STYLE4">SoftFalcon,商业版:2300元</p>
<p class="STYLE4"><img src="p1.jpg" width="245" height="279" /></p></td>
<td width="200" valign="top" class="style11"><p class="STYLE4">FalconDataBase,商业版2900元</p>
<p class="STYLE4"><img src="p2.jpg" width="266" height="264" /></p></td>
<td width="267" valign="top" class="style11"><p class="STYLE4">举仔仪器管理系统,商业版:1500元</p>
<p class="STYLE4"><img src="p3.jpg" width="280" height="269" /></p></td>
</tr>
</table>
<p> </p>
<p class="style6"><a href="http://www.zonej.cn">http://www.zonej.cn</a></p>
<p align="center" class="style6">目前访问人次:<font color="red"><%=Num %> </font></p>
</body>
</html>


---------------------------------
check.jsp代码如下:

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="error.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>已登录...</title>
<style type="text/css">
<!--
.style2 {
font-size: 16px;
font-family: "微软雅黑";
}
.style3 { font-size: 20px;
font-family: "微软雅黑";
}
-->
</style>
</head>

<body>

<hr align="center" />
<div align="center"><span class="style2">
<%
if(request.getParameter("password")==""){
response.setHeader("error.jsp","");
}

String str_userid =request.getParameter("userid");
String str_psw=request.getParameter("password");

out.println("欢迎您!" + str_userid + "<br>");
%>
</span>
</div>
<p align="center" class="style2"> </p>
<p align="center" class="style2"> </p>
<p align="center" class="style2"> </p>
<p align="center" class="style2"> </p>
<p align="center" class="style2"><a href="index.jsp" class="style3">返回首页.</a></p>
<p align="center" class="style2"><a href="http://www.zonej.cn">本站的友情站点:http://www.zonej.cn</a> -举仔空间</p>
<p align="center" class="style2"> </p>
</body>
</html>
...全文
73 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧