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. so in order to do this i thought of passing it to another jsp which prepares the json data from hashmap. But i dont find any solution to pass the hashmap to that jsp file. i have to pass these hashmap as post values in grid. jsp file data
在jsp我从dao java文件中获取hashmap但我需要将这些hashmap内容显示为网格。所以为了做到这一点,我想把它传递到另一个jsp,它从hashmap准备json数据。但我没有找到任何解决方案将hashmap传递给该jsp文件。我必须将这些hashmap作为post值传递给grid。 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. Then how can these values be accessed by prepareGrdData.jsp file to get the json data?
我们无法通过request.getParameter获取任何对象。然后,prepareGrdData.jsp文件如何访问这些值以获取json数据?
1 个解决方案
#1
0
One way may be set those as attribute, like request.setAttribute(key, value);
一种方法可以设置为属性,如request.setAttribute(key,value);
and
request.getAttribute(key);
#1
0
One way may be set those as attribute, like request.setAttribute(key, value);
一种方法可以设置为属性,如request.setAttribute(key,value);
and
request.getAttribute(key);