简体   繁体   English

如何将哈希映射从一个传递到另一个jsp,该jsp为jqgrid准备json数据

[英]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.

相关问题 将数据从一个jsp传递到另一个jsp并显示该jsp视图 - Pass data from one jsp to another and display that jsp view 如何从一个jsp传递到另一个与Spring会话中存储数据的jsp - How to pass from one jsp to another jsp storing data in session with Spring 如何将值从一个jsp传递到另一个jsp页面? - How to pass a value from one jsp to another jsp page? 如何将一个JSP传递给另一个JSP? - How to pass one JSP to another JSP? 将值从一个JSP页面传递到另一个JSP页面,并从First JSP获取响应数据 - Pass value from one JSP page to another JSP page and get response data back from First JSP 如何使用类似于JSP的Thymeleaf将表单数据从一个HTML传递到另一HTML? - How do I pass form data from one HTML to another using Thymeleaf similar to JSP? 如何将表的单选按钮值从一个jsp传递到另一个 - How to pass a radio button value of a table from one jsp to another 如何在弹簧中将下拉选择的值从一个jsp传递到另一个 - how to pass dropdown selected value from one jsp to another in springs 如何使用会话将ArrayList从一个jsp传递到另一个 - How to pass an ArrayList from one jsp to another using session 如何传递一个复选框值数组从一个JSP页面到另一个JSP页面 - How to pass an array of checkbox value From one JSP page to another
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM