<%@page contentType="text/html;charset=GBK"%>
<%@page import="java.util.*,com.baidu.manageSystem.machineRoom.dto.*"%>
<jsp:include page="/iqcerp/left.jsp"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>User management interface</title>
<style type="text/css">
<!--
.style1 {
font-weight: bold;
}
-->
</style>
</head>
<script>
document.getElementById("a").readOnly = false;
document.getElementById("b").readOnly = false;
document.getElementById("c").readOnly = false;
document.getElementById("d").readOnly = false;document.getElementById("1").readOnly = false;
document.getElementById("2").readOnly = false;
document.getElementById("3").readOnly = false;
document.getElementById("4").readOnly = false; /**
*用第二个表单执行修改、删除、批量修改、批量删除)
*/
function doSubmit(url){
document.forms[0].action = url;
document.forms[0].submit();
}
/**
*按主键删除
*/
function doDelete(id){
if (countMultichoice() < 1){
alert("请选择数据行");
return;
}
var bool = window.confirm("确定删除吗?");
if (bool){
var url = '${pageContext.request.contextPath}/accreditor.do?menu=deleteById&id='+id;
doSubmit(url);
}
}

/**
*批量修改
*/
function doUpdateBulk(){
if (countMultichoice() < 1){
alert("请选择数据行");
return;
}
var bool = window.confirm("确定修改选中变量吗?");
if (!bool){
return;
}
var url = '${pageContext.request.contextPath}/accreditor.do?menu=modifyBulkDo';
document.forms[0].code.disabled = false; 
document.forms[0].user.disabled = false;
document.forms[0].enname.disabled = false;
document.forms[0].chname.disabled = false; 
document.forms[0].password.disabled = false;
document.forms[0].sex.disabled = false;
document.forms[0].tel.disabled = false; 
document.forms[0].mobile.disabled = false;
document.forms[0].email.disabled = false;
document.forms[0].idnumber.disabled = false;
document.forms[0].position.disabled = false; 
document.forms[0].photo.disabled = false;
document.forms[0].closed.disabled = false;

document.forms[0].code.value = ''; 
document.forms[0].user.value = ''; 
document.forms[0].enname.value = '';
document.forms[0].chname.value = ''; 
document.forms[0].password.value = ''; 
document.forms[0].sex.value = '';
document.forms[0].tel.value = ''; 
document.forms[0].mobile.value = ''; 
document.forms[0].email.value = '';
document.forms[0].idnumber.value = ''; 
document.forms[0].position.value = ''; 
document.forms[0].photo.value = '';
document.forms[0].closed.value = ''; 

doSubmit(url);
}
/**
*全选
*/
function selectAll(box, multichoiceName){
var objs = document.getElementsByName(multichoiceName);
for (var i=0; i<objs.length; i++){
objs[i].checked = box.checked;
}
}
/**
*计算选中的复选框
*/
function countMultichoice(){
var sum = 0;
var objs = document.getElementsByName('multichoice');
for (var i=0; i<objs.length; i++){
if (objs[i].checked){
sum++;
}
}
return sum;
}
</script> <!--获取已有-->
<% 
List accreditorList = (List)request.getAttribute("accreditorList");int m = 0;
%><body>
<form name="form1" action="" method="post">
  <table width="844" height="400" border="1"  cellpadding="0" cellspacing="0" bordercolor="#CCFFFF" frame=void>
    <tr>
      <td height="38" colspan="7"><div align="center"><span class="style1">消息提示:${msg}</span></div></td>
    </tr>
    <tr>
    <td width="42" height="24">choose</td>
    <td width="105" height="24">Id</td>
    <td width="105" height="24">Name</td>
    
    
   
  </tr>
  <%
  //循环输出用户基本信息
  for (int i = 0; accreditorList != null && i < accreditorList.size(); i++) {
   Accreditor accreditor = (Accreditor)accreditorList.get(i);
   m++;
  %>
    <tr>
      <td height="24"><input id="a" type="checkbox" name="multichoice" value="<%=i%>" readOnly></td>
      <input type="hidden" id="b" name="Id<%=i%>" size="15" value="<%=accreditor.getId()%>" readOnly>
  <td height="24"><input id="c" type="text" name="Id<%=i%>" size="15" value="<%=accreditor.getId()%>" readOnly></td>
  <td height="24"><input id="d" type="text" name="name<%=i%>" size="15" value="<%=accreditor.getName()%>" readOnly></td>
    </tr>
    <%
  }
  %>
  <!--始终保持一个空行以供输入-->
  <tr>
     <td height="24"><input id="1" type="checkbox" name="checkbox" value="<%=m%>" readOnly></td>
      <input type="hidden" id="2" name="Id<%=m%>" size="15" value="" readOnly>
  <td height="24"><input id="3" type="text" name="Id<%=m%>" size="15" value="" readOnly></td>
  <td height="24"><input id="4" type="text" name="name<%=m%>" size="15" value="" readOnly></td>
    </tr>
    <tr>
    
    </tr>
    <tr>
      <td colspan="7"><div align="center"></div>        <div align="center">
      
  <a href="/iqcerp/defaultroot/iqcerp/DateAdd/employeeAdd.jsp">   <img src="file:///D|/My Documents/未命名站点 1/add.jpg">
 </a>
  <%
 
  Accreditor accreditor = (Accreditor)accreditorList.get(0);
  String id=accreditor.getId();
  System.out.println("////");
  System.out.println(id);
   %>
   
       <a href="javascript:doDelete('<%=id%>');"><img src="file:///D|/My Documents/未命名站点 1/refresh.jpg"></a>
   <a href="javascript:doSubmit('${pageContext.request.contextPath}/accreditor.do?menu=modifyPage&id='<%=id%>)"><img src="file:///D|/My Documents/未命名站点 1/print.jpg"></a>
        </div></td>
    </tr>
  </table>
</form></body>
</html>

解决方案 »

  1.   

      <a href="javascript:doSubmit('${pageContext.request.contextPath}/accreditor.do?menu=modifyPage&id='<%=id%>)"><img src="file:///D|/My Documents/未命名站点 1/print.jpg"></a>  这个超链接按下无效,并不实现跳转
      

  2.   

    没猜错是脚本错误 function doSubmit(url){
            document.forms[0].action = url;
            document.forms[0].submit();
        }在方法里加上 alert(url)  第一看看会不会alert 如果不alert就是doSubmit('${pageContext.request.contextPath}/accreditor.do?menu=modifyPage&id='<%=id%>)" 出了脚本错误   第二看下请求地址
      

  3.   

    顺便说句 '${pageContext.request.contextPath}/accreditor.do?menu=modifyPage&id='<%=id%>改成
    '${pageContext.request.contextPath}/accreditor.do?menu=modifyPage&id=<%=id%>'
      

  4.   

    <a href="javascript:doDelete('<%=id%>');"><img src="file:///D|/My Documents/未命名站点 1/refresh.jpg"></a>
    ???超链接的href应该是地址,如果你想调用js方法的话,应该在onclick方法里调:
    <a onclick="javascript:doDelete('<%=id%>')"></a>
      

  5.   


    其实 href里写javascript 也会被调用的
      

  6.   


    up,最好用firebug调试方便些!
      

  7.   

    你说我该如何确定href链接到的页面的路径,我那个页面路径不知道该怎么确定  ,你帮我看下    我试了好多次 都无效<a href="/iqcerp/defaultroot/iqcerp/DateAdd/employeeAdd.jsp">
      

  8.   


    是指访问不到employeeAdd.jsp页面??
      

  9.   

    <a href="#" onclick="javascript:doSubmit('${pageContext.request.contextPath}/accreditor.do?menu=modifyPage&id=<%=id%>')"><img src="file:///D|/My Documents/未命名站点 1/print.jpg"></a>
      

  10.   

    我按照你告诉我的方法改了,结果出现如下错误javax.servlet.ServletException: Request[/accreditor] does not contain handler parameter named 'menu'.  This may be caused by whitespace in the label text.
    at org.apache.struts.actions.DispatchAction.unspecified(DispatchAction.java:215)
    at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:249)
    at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at com.baidu.manageSystem.common.filter.EncodingFilter.doFilter(EncodingFilter.java:32)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Thread.java:619)
      

  11.   

    你这个应该是struts的配置问题