myeclipse中怎么点击按钮跳转网页

就是想实现我在点击建好的jsp工程里的按钮时,能够跳转到另外一个已经设置好的界面

通过点击按钮实现跳转页面可以使用jsp的表单提交的方法,将要跳转的页面填写在表单的action里,或者在action里面填写一个servlet类,通过这个servlet来处理跳转。
事例代码如下:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Demo</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">
</head>
<body>
<form action="页面地址或者servlet类地址">
<input type="submit" value="跳转"/>
</form>
</body>
</html>
当然,这里不仅可以通过form表单来处理跳转,也可以通过超链接的方式来实现页面的跳转,将要跳转的页面地址或者servlet类地址填在超链接的href里。
温馨提示:内容为网友见解,仅供参考
第1个回答  2015-05-04
<form action="lo.jsp" method="post">
用户名:<input type="text" name="name" /><br/>
密     码:<input type="password" name="pwd"/><br/>
<input type="submit" value="登录"/>
<input type="reset" value="重置" />

form表单的action 就是要跳转的页面。

本回答被网友采纳
第2个回答  2015-05-04
使用javascript或者使用表单。
相似回答