<div align="center"> <s:submit value="删除" class="searchbutton" method="deleteAuthByEmpId"/> <input type="hidden" name="empAuthId" value=<s:property value="#authorization.empId"/>_<s:property value="#authorization.authId"/> > </div> 传递的数值是全部的这样却可以获取单条的数值<div align="center"> <input type="submit" value="编辑" name="delete" class="input2"/> <input type="hidden" name="flag" value=<s:property value="#employee.number"></s:property> /> </div>注意:不能使用两个hidden 终极结局方案,使用超链接 jsp中:<div align="center"> <%-- <s:submit value="删除" class="searchbutton" method="deleteAuthByEmpId"> <input type="hidden" name="empAuthId" value=<s:property value="#authorization.empId"/>_<s:property value="#authorization.authId"/> > </s:submit> --%> <a href="deleteAuthByEmpId.action?empAuthId=<s:property value="#authorization.empId"/>_<s:property value="#authorization.authId"/>"> <input type="button" value="删除" class="searchbutton"> </a> </div> struts中配置:<action name="deleteAuthByEmpId" class="im.acs.action.GateAction" method="deleteAuthByEmpId"> <result name="success" type="redirect">queryAuthorizationAll</result> </action> action中:/* * 删除授权 * */ public String deleteAuthByEmpId(){ System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>deleteAuth>>>>>>>>>>>>>>>>>>>>>"); String[] empAuthArray = empAuthId.split("_"); int employeeId = Integer.parseInt(empAuthArray[0]); int authId = Integer.parseInt(empAuthArray[1]); List<Authorization> authList = gateService.findAuthByEmpId(employeeId); //此empId已授权且只有一条,更新此条记录 if(authList.size() == 1 && authList.get(0).getFlag() == 1){ Authorization auth = new Authorization(); auth.setId(authList.get(0).getId()); auth.setFlag(0); auth.setGateId(1); auth.setEmployeeId(employeeId); auth.setIdentificationId(authList.get(0).getIdentificationId()); //update gateService.updateAuth(auth); }//授权信息多条 else if(authList.size() >= 2){ //delete gateService.deleteAuthByAuthId(authId); } return SUCCESS; }
struts中submit标签传递参数问题
最新推荐文章于 2021-08-24 10:16:51 发布