js的openWindow()彈出新視窗與引數的傳遞
阿新 • • 發佈:2018-12-10
往openWindow()中傳入引數
var ids = $("#ids").val();
var xcbh = _grid.getRowsValues(ids, "TYZJKXC_ID");
openWindow(ids,xcbh);
openwindow()方法
function openWindow(ids,xcbh){ debugger; var options = { modal : true, title : "日誌", collapsible : false, minimizable : false, maximizable : false, closable : true, closed : false }; var uid = "self_card_"; options["id"] = uid; winFormDesigner = UIFactory.getUI(uid); if(!winFormDesigner){ winFormDesigner = UIFactory.create(xpad.ui.Window, options); } var root = jQuery("body"); var offset = root.offset(); var winleft = 0; var wintop = 0; var newSize = {}; newSize["left"] = 0; newSize["top"] = 0; newSize["width"] = jQuery("body").width(); newSize["height"] = jQuery("body").height(); winFormDesigner.window("resize", newSize); setTimeout(function(){ if(ids==""){ winFormDesigner.loadURL(Leopard.getContextPath() + "/platform/views/cusviews/JKJL_VIEWS/tyzjkjf.jsp?isRead=true"); }else{ winFormDesigner.loadURL(Leopard.getContextPath() + "/platform/views/cusviews/JKJL_VIEWS/tyzjkjf.jsp?ids="+ids+"&xcbh="+xcbh); } }, 0); }
jsp頁面獲取傳來的值
<input id="ids" type="hidden" value="<%=request.getParameter("ids") %>"/> <input id="xcbh" type="hidden" value="<%=request.getParameter("xcbh") %>"/> <c:set var="ctx" value="${pageContext.request.contextPath}" /> <input id="root" type="hidden" value="${ctx }"/>
js獲取頁面的值
var root = null; var ids = null; var xcbh = null; $(document).ready(function() { root = $("#root").val(); ids = $("#ids").val(); xcbh = $("#xcbh").val(); initpage(); }); function initpage(){ xctyz(); } function xctyz(){ param = {"xcbh":xcbh,"ids":ids} } $.ajax({ url:root + "/Addxctyz", data:param, type:"post", dataType:"json", success:function(data){ alert("儲存成功"); }, error:function(){ alert("伺服器正忙,請稍後重試"); } })
後臺接收引數
@SuppressWarnings("unchecked")
@RequestMapping("/Addxctyz")
@ResponseBody
public Boolean Addxctyz(HttpServletRequest request, HttpServletResponse response,String requestParam){
String xcbh = request.getParameter("xcbh");
String ids = request.getParameter("ids");
}