jsp代码跳转

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>用户登录</title>
</head>
<body>
<form name="from1"method="post"action="Howhandle.jsp">
用户名:<input type="text"name="username">
密 码:<input type="password"name="userpassword">
<input type="submit"value="登录">
<input type="submit"value="注册">
</form>
</body>
</html>
这是代码,本来是点登陆,然后跳刀Howhandle的jsp界面上,账号密码是写死的,也可以跳转,但是我想在加一句代码,就是点注册的时候,可以跳转到注册的界面,应该怎么写?在线等~~跪求

第1个回答  2014-05-23
<input type="submit"value="注册">改成<input type="button"value="注册" onclick="regist()">

写个js函数
function regist()
{
window.location.href="regist.jsp";

}追问

输出不来啊,成这个样子了

追答



">

My JSP 'index.jsp' starting page

function regist()
{
window.location.href="regist.jsp";
}

用户名:
密 码:

追问

实现不了,要的是登录和注册按钮都可以跳转,这样两个就都跳转不了了,那个regist.jsp我改成自己的jsp的名称,根本跳转不过去 724987825

追答

你的登录是通过form表单跳转的,注册是通过onclick点击事件跳转的
发你邮箱了,导入到myEclipse中运行一下就知道了

追问

我用的是Eclipse,是Java EE,不是Myeclipse 登录用form实现了,注册的那个jsp是把regist.jsp改成我自己i的jsp吗

追答

这个没有关系,运行效果一样

本回答被提问者采纳