㈠ jsp在新窗口打开
直接对你的按钮做个链接就OK了嘛~
<a href="./help/<%=request.getAttribute("mod_url")%>.html" target="_blank">帮助</a>
其中的属性target="_blank"就表示打开一个新的页面
补充:在JSP页面先调用你action里面的那个方法获得你返回的URL给字符串s,然后将上面的语句中的“=request.getAttribute("mod_url")”改为“=s”就OK了……
㈡ jsp里面弹出一个新的窗口怎么做
1、你可以用一个来div作为弹出窗口;源
2、将你的这个div装饰成一个窗口,很简单;
3、在这个div中,你可以写一些文本输入框,form表单或者其他标签都可以;
4、你在用绝对定位将这个div移到你要的未知。
㈢ JSP打开新窗口问题
如果单纯在jsp页面进行跳转可以直接用
<ahref="./b.jsp">
servlet中跳转可以
java">response.sendRedirect("./b.jsp");
不知道你是不是这个意思?
㈣ 如何在jsp页面上实现点击注册按钮,弹出一个窗体来注册(类似于百度贴吧的登录和注册),求详细代码和注释
jsp中的注册弹出新窗口是通过window.open一个新页面来实现的。
页面register.jsp代码如下:
<%@ page contentType="text/html; charset=gb2312" language="java" import="cn.wy.Pet.User" errorPage="" %>
<!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 {
color: #FF0000;
font-weight: bold;
}
.STYLE2 {color: #FF0000}
.STYLE3 {
font-size: 18px;
font-weight: bold;
}
-->
</style>
</head>
<body style="font-size:12px">
<form id="form1" name="form1" method="post" action="<%=actionStr%>reg">
<p align="center"><br />
<span class="STYLE3">用户注册</span></p>
<table width="582" height="302" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#BCACD2">
<tr>
<td width="80" align="right">用户名:</td>
<td width="496" align="left"><input name="userName" type="text" id="userName" size="16" maxlength="16" />
<span class="STYLE1">*</span> 3~16位字母或者数字(如:8hack)</td>
</tr>
<tr>
<td align="right">密码:</td>
<td align="left"><input name="password1" type="text" id="password1" size="16" maxlength="16" />
<span class="STYLE1">* </span> 3~16位字母或者数字(如:abc123)</td>
</tr>
<tr>
<td align="right">确认密码:</td>
<td align="left"><input name="password2" type="text" id="password2" size="16" maxlength="16" />
<span class="STYLE1">*</span> 必须和上面输入的密码相同</td>
</tr>
<tr>
<td align="right">电子邮件:</td>
<td align="left"><input name="email" type="text" id="email" maxlength="20" />
<span class="STYLE1">*</span> 找回密码和联系用(如:[email protected])</td>
</tr>
<tr>
<td align="right">联系电话:</td>
<td align="left"><input name="tel" type="text" id="tel" size="20" maxlength="20" />
如(0871-8888888,13888853113)</td>
</tr>
<tr>
<td align="right">联系地址:</td>
<td align="left"><input name="address" type="text" id="address" maxlength="50" /></td>
</tr>
<td height="40" colspan="2" align="center"><input type="submit" name="Submit" value="确认注册" />
<input type="reset" name="Submit2" value="重新填写" /></td>
</tr>
</table>
</form>
</body>
</html>
后台servlet的处理:
public class reg extends HttpServlet
{
public reg()
{
}
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
PrintWriter out;
DBConnection dbc=null;
String userName;
String psd;
String email;
String tel;
String address;
int popedom;
response.setContentType("text/html;charset=UTF-8");
out = response.getWriter();
try{
dbc = new DBConnection();
PreparedStatement ps = null;
userName = request.getParameter("userName");
psd = login.encrypt(request.getParameter("password1").toString());
email = request.getParameter("email");
tel = request.getParameter("tel");
address = request.getParameter("address");
popedom = Integer.parseInt(request.getParameter("popedom"));
if (userName != null && psd != null && email != null)
{
ps = dbc.getCon().prepareStatement("insert into [User](UName,Upass,UEmail,UTel,UAddress,UPopedom) values(?,?,?,?,?,?)");
ps.setString(1, userName);
ps.setString(2, psd);
ps.setString(3, email);
ps.setString(4, tel);
ps.setString(5, address);
ps.setInt(6, popedom);
ps.execute();
System.out.print("新用户注册:" + request.getParameter("userName") + " ");
out.print("<script>alert('恭喜您:注册成功!现已经登录到网站!');history.go(-1)</script>");
}
if (dbc != null)
dbc.dbClose();
}
catch(SQLException ex)
{
out.print("<script>alert('注册失败!数据库连接错误!');history.go(-1)</script>");
ex.printStackTrace();
if (dbc != null)
dbc.dbClose();
}
}
}
㈤ html或者jsp中如何点击超链接,打开一个新窗口,点击一次,打开一个
在超链接中有一个target 属性,它是规定在何处打开 action URL的一个属性,其用法内如下:
<ahref="test.html"target="_blank"></a>
2、点击这个连接将会在新的选项卡中打开test.html页面
㈥ 如何在jsp中点击一个超链接时弹出一个新的窗口
使用
<a href="http://unigreen.cn" target="_blank">超链接文字</a>
其中target="_blank"就是新窗口打开的版意权思。
㈦ 在JSP页面上增加编辑窗口,应如何操作
按钮上onClick事件调用个js方法:
function
winhref()
{
var
blankObj
=
window.open('./add.jsp','_blank','top=100,left=100,width=600,height=300,scrollbars=yes,toolbars=no');
}
这样调用的页面add.jsp会在新窗口弹出
㈧ 急急急~~~jsp 点击按钮打开一个新窗口
用form的submit做按钮,点击提交后就自动跳转到action指定的新页面去了吧