[英]how to pass hashmap from one to another jsp which prepares the json data for the jqgrid
i want to pass the hashmap object to another jsp to prepare the json data for me to create the grid. 我想将hashmap对象传递给另一个jsp,以为我准备json数据以创建网格。
in the jsp i am getting the hashmap from the dao java files but i need these hashmap contents to be displayed as a grid. 在JSP中,我从dao Java文件中获取哈希图,但是我需要将这些哈希图内容显示为网格。 so in order to do this i thought of passing it to another jsp which prepares the json data from hashmap.
因此,为了做到这一点,我想到了将其传递给另一个从hashmap准备json数据的jsp。 But i dont find any solution to pass the hashmap to that jsp file.
但是我没有找到任何解决方案来将哈希图传递给该jsp文件。 i have to pass these hashmap as post values in grid.
我必须将这些哈希图作为网格中的发布值传递。 jsp file data
jsp文件数据
Hashmap groupMap1= GroupMap.getGroupMapModel();
Hashmap groupMap2 = GroupMap.getGroupMappingNames();
here is the code to create grid 这是创建网格的代码
jQuery("#list").jqGrid({
altRows:false
,autowidth:true
,url:'<%=request.getContextPath()%>/jsp/common/prepareGridData.jsp'
,datatype: "json"
,height: "100%"
,colNames:<%=colNames%>
,colModel:<%=colModel.toString()%>
,paging: true
,rowNum:25
,rowList:[25,50,75,100]
,loadonce:true
,caption: "Group Listing"
,pager:"#gridBottom"
,multiboxonly:false
,multiselect:false
,scrollrows:false
,shrinkToFit: false
,viewrecords:true
,postData:{groupMap1:"<%=groupMap1%>",groupMap2:"<%=groupMap2%>"}
}).navGrid('#page',{edit:false,add:false,del:false});
}
we cannot get any object thru request.getParameter. 我们无法通过request.getParameter获取任何对象。 Then how can these values be accessed by prepareGrdData.jsp file to get the json data?
然后如何通过prepareGrdData.jsp文件访问这些值以获得json数据?
One way may be set those as attribute, like request.setAttribute(key, value);
一种方法可以将其设置为属性,例如
request.setAttribute(key, value);
and 和
request.getAttribute(key);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.