我在jsp中有一个注册页面,其中嵌入了html ...注册后我希望我的页面被重定向到登录页面进行登录但是我无法做到这一点...请帮助如何这样做..我已经给了href,但它不起作用..这段代码友好地帮助我..
CODE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Online pool</title>
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Abel|Satisfy' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" media="screen" />
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript">
function welcome(){
alert("Thanx for registering");
}
</script>
</head>
<body>
<div class="row" style="margin-top: 5%">
<div class="col-md-8 col-md-offset-2">
<div id="wrapper" class="well">
<center>
<h1><font color="red"><i>New Passenger Registration</i></h2></font>
<form action="empadd.jsp" class="form-horizontal">
<div class="form-group">
<label for="inputEmail" class="col-lg-4 control-label">Employee Id</label>
<div class="col-lg-3">
<input type="number" name="eid" value="" class="form-control" />
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="col-lg-4 control-label">User Name</label>
<div class="col-lg-3"><input type="text" name="uname" value="" class="form-control" />
<span>Name is Same as Username</span>
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="col-lg-4 control-label">Password</label>
<div class="col-lg-3"><input type="password" name="pwd" value="" class="form-control" />
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="col-lg-4 control-label">Email</label>
<div class="col-lg-3"><input type="email" name="email" value="" class="form-control"/>
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="col-lg-4 control-label">Mobile</label>
<div class="col-lg-3"><input type="number" name="mno" value="" class="form-control"/>
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="col-lg-4 control-label">Works at</label>
<div class="col-lg-3"><input type="text" name="cmp" value="" class="form-control"/>
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="col-lg-4 control-label">Designation</label>
<div class="col-lg-3"><input type="text" name="desg" value="" class="form-control"/>
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="col-lg-4 control-label"></label>
<div class="col-lg-3"> <input type="submit" value="submit" class="btn btn-success" onclick="welcome()"/>
<a href="index.jsp" class="btn btn-warning">Back</a>
</div>
</div>
</form>
</center>
<!-- end #footer -->
</body>
</html>
答案 0 :(得分:0)
您正在使用注册数据将表单重定向到empadd.jsp,如此处所示
<form action="empadd.jsp" class="form-horizontal">
此外,您正在显示警告onclick,这在结构上并不正确。
如果你需要使用javascript,你可以这样做 -
window.location.href = './login.jsp';
如果你想在empadd.jsp中进行重定向,那么你可以这样做 -
response.sendRedirect("login.jsp");
这是你的全部选择!