点击 【定酬新】 后弹出这样的页面
程序用hibernet,struts实现
第一个页面列出信息已经实现了,弹出页面如果用window.open实现的话 要怎么样动态传参呢?
我用list方法获得需要的所有员工信息,然后再get的
这里要for循环,如果直接window.open( "addMoney.jsp?empId=<%=em.getEmpId() %>")【empId是员工id】
在addMoney.jsp页面获取id=<%=request.getParameter("empId") %>的话
获得得是list循环的最后一个值
这样就实现不了动态的传参了
请问要怎么样实现呢?下面是根据for循环列出员工信息的部分代码: <body> <table border="0" bordercolor="green" width="700" height="240">
<tr>
<td class="alt">编号</td><td class="alt">姓名</td><td class="alt">部门</td><td class="alt">E_mail</td><td class="alt">手机号码</td><td class="alt">QQ</td><td class="alt"></td>
</tr>
<%
EmployeeBs ebs=new EmployeeBs();
List list=ebs.getAllNoMoney();
for(int i=0;i<list.size();i++){
Employee em=(Employee)list.get(i);
DeptBs dbs=new DeptBs();
String dname=em.getDept().getDeptName();
%>
<script type="text/javascript"> function play()
{
window.open( "addMoney.jsp?empId=<%=em.getEmpId() %>","_blank","toolbar=no,location=no,statu=no,menubar=no,scrollbars=auto,width=700,height=400,resizable=no" );} </script>
<tr>
<td><%=em.getEmpId() %></td><td><%=em.getEmpName() %></td><td><%=dname %></td><td><%=em.getEmail() %></td><td><%=em.getMobilephone() %></td><td><%=em.getQq() %></td><td><a href="noMoney.jsp" onclick="play()">定薪酬</a></td>
</tr>
<%} %>
</table>
</body>
ps:因为太菜 所以没有分可以给各位大大 希望大家多多帮忙!
解决方案 »
- jsp中 showmodaldialog 分页 问题
- 急急!基于RBAC的权限系统的设计和实现
- 初次配置spring出错
- hibernate 连接数据库问题 表格无法映射 Servlet.service() for servlet default threw exception
- 关于SmartUpload上传超过1M出现不成功
- 用swfupload 做的一个视频上传,遇到的蛋疼问题 求解
- 用tomcat发布的jsp信息系统,网络堵塞如何解决
- 求批量查询网站信息的代码
- 关于中文显示的问题,与java,jsp,mysql都有关
- jsp死活不让调用DAO设计里面的方法
- java 无法更新数据库 大大们救命啊~! 毕业设计啊~
- JSP 中 为什么javascript 代码不起作用
<script type="text/javascript"> function play(id)
{
window.open( "addMoney.jsp?empId="+id,"_blank","toolbar=no,location=no,statu=no,menubar=no,scrollbars=auto,width=700,height=400,resizable=no" ); } </script> <body> <table border="0" bordercolor="green" width="700" height="240">
<tr>
<td class="alt">编号 </td> <td class="alt">姓名 </td> <td class="alt">部门 </td> <td class="alt">E_mail </td> <td class="alt">手机号码 </td> <td class="alt">QQ </td> <td class="alt"> </td>
</tr>
<%
EmployeeBs ebs=new EmployeeBs();
List list=ebs.getAllNoMoney();
for(int i=0;i <list.size();i++){
Employee em=(Employee)list.get(i);
DeptBs dbs=new DeptBs();
String dname=em.getDept().getDeptName();
%>
<tr>
<td> <%=em.getEmpId() %> </td> <td> <%=em.getEmpName() %> </td> <td> <%=dname %> </td> <td> <%=em.getEmail() %> </td> <td> <%=em.getMobilephone() %> </td> <td> <%=em.getQq() %> </td> <td> <a href="noMoney.jsp" onclick="play(<%=em.getEmpId()%>)">定薪酬 </a> </td>
</tr>
<%} %>
</table>
</body>
连窗口都弹不出来了
{
alert(id);
window.open("addMoney.jsp?empId="+id,_blank","toolbar=no,location=no,statu=no,menubar=no,scrollbars=auto,width=700,height=400,resizable=no" );
}<a href="noMoney.jsp" onclick="javascript:alert(<%=em.getEmpId()%>);play(<%=em.getEmpId()%>)">定薪酬 </a>弹出一下,看看id有没有值。尽量不要用window.open了,容易被浏览器拦截。http://www.baidu.com/s?wd=div%C4%A3%C4%E2%B4%B0%BF%DA